f******e 发帖数: 582 | 1 I am programming using C under Linux. I have the following piece of code:
L1: printf("\nChild PID is: [%d]",getpid());
L2: sleep(5);
L3: printf("\nChild is Terminating...\n\n\n");
When I compile and run the program, the output of "Child PID is: [%d]" is
after sleep(5). But based on the program, it should be before sleep(5).
Where is wrong? Thanks a lot. | l*********s 发帖数: 5409 | 2 flush the output buffer immediately by printf(....\n") |
|