Mail Archives: djgpp/1996/05/01/01:40:29
Fernando Marcos (fmarcos AT jet DOT es) writes:
> "Alexander V. Lukyanov" <lav AT video DOT yars DOT free DOT net> wrote:
>
>>> I wrote some simple code that utilizes the gotoxy() and printf()
>>> statements to place text on the screen, ala:
>>> When I run this type of code nothing appears on the screen. I can see
>>> the cursor jumping around, but nothing else. However, if I include a
>>> '\n' in the printf statement, things display fine, *or* as soon as I
>>> printf with a '\n' outside the loop, then **all** the text gets
>>> displayed. It's almost as if it's being buffered, and isn't displayed
>>> until a '\n' comes along.
>
> That is because you need to fflush(stdout) after you write a string
> without a trailing "\n". It is a normal printf() "feature".
>
I've seen this myself. Printf buffers things. Use cprintf, if you want to
avoid the \n and the problems this may cause on the bottom screen line.
Cprintf also enables colored text and backgrounds. On the other hand the
text it produces isn't captured by DOS redirection commands, i.e. to
printer or to a file (I don't think it is anyways...?)
--
.*. "Clouds are not spheres, mountains are not cones, coastlines are not
-() < circles, and bark is not smooth, nor does lightning travel in a
`*' straight line." ,------------------------------------------------
-- B. Mandelbrot | Paul Derbyshire (PGD) ao950 AT freenet DOT carleton DOT ca
- Raw text -