[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: [LI] C Programming problem
type
printf("Loading..\n");
then it'll work properly
anand
Mrinal Kalakrishnan wrote:
> Hi,
>
> This particular piece of code behaves differently when compiled with gcc
> (Linux), when compared to Turbo C or DJGPP (in DOS).
>
> #include <stdio.h>
>
> void main()
> {
> printf("Loading..");
> float i,j;
> j=12345.6789;
> for (i=0.0;i<50000.0;i+=0.01) j=j*j;
> printf("Done\n");
> }
>
> The expected behaviour would be that "Loading" gets printed, then a delay, and
> then "Done" gets printed. But, that doesn't happen. Instead, there is a long
> delay initially, then "loading" and "done" get printed immediately one after
> the other. However, if I add a newline in the "Loading" string, then it gets
> printed immediately, followed by the delay.
>
> Anybody faced this problem before - any solutions?
>
> ----------------------------------------------------------------
> Mrinal Kalakrishnan
> mrinal@xxxxxxxxx
> http://listen.to/mrinal
> ----------------------------------------------------------------
> --------------------------------------------------------------------
> The Linux India Mailing List Archives are now available. Please search
> the archive at http://lists.linux-india.org/ before posting your question
> to avoid repetition and save bandwidth.
--------------------------------------------------------------------
The Linux India Mailing List Archives are now available. Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.