Date: Thu, 7 Jan 1999 19:16:21 -0500 (EST) From: Daniel Reed To: MstrX1 cc: djgpp AT delorie DOT com Subject: Re: Newbie, stupid 'printf' Question In-Reply-To: <19990107175907.21430.00007885@ng-fp1.aol.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com 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 I either want less corruption, or more chance to participate in it. -- Ashleigh Brilliant