Mail Archives: djgpp/1995/11/13/06:29:34
> I find that when I do a printf, or putchar, nothing appears on the screen
> until I send a "\n" to standard output
Yes, this is a matter of flush. The problem is that djgpp is ported from
an U..X compiler. And, under U..X, all outputs goes into a buffer until
a EndOfLine. So nothing comes to screen until '\n' char. This is the
right way to use stdout. DOS is another time wrong :(
The solution is to tell the output file to release the buffer. This can
be done with a fflush(stdout);
So, the equivalent of :
printf("Hello. Begining process...");
/* ... Processings ... */
printf("End process.\n");
in 'dos'-C (I mean TurboC, ZorthecC...), is :
fprintf(stdout,"Hello. Begining process..."); fflush(stdout);
/* ... Processings ... */
fprintf(stdoutm"End process.\n");
in 'good' C (And djgpp is a good C compiler).
Hope it helps,
Eric.
- Raw text -