I want to write a small program that should print something like
CPU testing ... done
RAM testing ... done
etc.
I wrote the following program in C:
printf( "testing RAM...\t\t" ); sleep( sleep_time ); printf( "done\n\n" ); printf( "testing HDD...\t\t" ); sleep( sleep_time ); printf( "done\n\n" );
where sleep_time is 2.
However, instead of first typing βCPU testing ...β, then waiting, and then typing βdone,β it first waits and then prints the entire line, which is not quite what I had in mind.
I believe this is due to automatic compiler optimization.
Anyway, what can I do to get the desired result?
I am using Xcode 3.1 in OSX 10.5.6
Thanks,
Bastian
source share