Mail Archives: djgpp/1998/08/28/10:48:16
>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 -