Mail Archives: djgpp/1999/01/07/19:16:34
On 7 Jan 1999, MstrX1 wrote:
) if I don't type a LF("\n") at the end of my printf-text
) the text isn't printed correctly under MS-DOS.
) Most times this isn't a problem, because I need
) it anyway, but if I want to print text at the bottom
) of the screen and I print (printf("Hello World\n")),
) the screen scrolls down and the top-line will be destroyed.
)
) How can I print it correctly without using a "\n" at the end,
) or stop this scrolling ?
Either use setvbuf() (I believe) to take stdout from cooked mode
(buffered) into raw mode (unbuffered), or simply use
printf("Hello World");
fflush(stdout);
fflush() will cause anything in the buffer for a FILE * to be written to
the actual file it's attached to, which has the effect of causing your
text to be printed without having to add in a \n.
--
Daniel Reed <n AT ml DOT org>
I either want less corruption, or more chance to participate in it. -- Ashleigh Brilliant
- Raw text -