delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/28/10:48:16

From: matthew DOT krause AT juno DOT com
To: thruska AT tir DOT com
Cc: djgpp AT delorie DOT com
Date: Fri, 28 Aug 1998 09:53:18 -0400
Subject: Re: Display question...
Message-ID: <19980828.103847.3926.4.matthew.krause@juno.com>

>I'm new to this mailing list (but I'm on about 8 others, so it's nothing
>really new to me how things work). 
That's gotta be a motherload of mail :>)

> Anyway, I have a problem with the
>printf command.  When I do something like:
> printf("Hello World!");
>It won't print anything to the screen until either the program is
finished
>or until a newline character is printed.

Yeah. Printf is ?buffered? or something so to get your message to be
printed out, you must say printf("Hello World!\n); the \n is a newline
character (It might be ASCII 110 IIRC). If your use cprintf (from
conio.h) you need to say \r\n for the carriage Return and New line.

Alternatively, if you need the cursor to stay on the same line, you could
do something like:
#include <stdio.h>
int main()
{
printf("Hello World");
fflush(stdout);
return 0;
}

Basically, what this does is put the string "Hello World" into a buiffer,
which fflush then dumps to stdout (ie the screen.)


_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

- Raw text -


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