delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/07/18:45:15

From: "Peter Daniel Davies" <grobe AT globalnet DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Newbie, stupid 'printf' Question
Date: Thu, 7 Jan 1999 23:41:02 -0000
Lines: 27
Message-ID: <773gna$2q9$1@newnews.global.net.uk>
References: <19990107175907 DOT 21430 DOT 00007885 AT ng-fp1 DOT aol DOT com>
NNTP-Posting-Host: 195.147.145.230
X-Newsreader: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

MstrX1 wrote in message <19990107175907 DOT 21430 DOT 00007885 AT ng-fp1 DOT aol DOT com>...
>Hello,
>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 ?
>
>J. Diederich
>

Hello fellow newbie.
Insert the following line beneath the printf statement without the \n at the
end of the string.

fflush(stdout);

This empties the output buffer to the output device 'stdout' which is
defined in the stdio library.



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019