由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - one C programming question - Thanks.
相关主题
fork(): why both if and else are executed?一个简单的算法问题?
A thread questionint64_t printf
[转载] 简单的题都不敢做了.问一道C++的题目。 (转载)
little endian vs big endianQuestion on using ## in #define
GCC 居然允许变量长度的向量一道c
a question about CGIC/C++函数调用和栈内存
全局对象select的timeout怎么不work
谁给解释下这个比较弱的问题?一个关于Insight debugger的问题
相关话题的讨论汇总
话题: question话题: pid话题: nchild话题: sleep
进入Programming版参与讨论
1 (共1页)
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")
1 (共1页)
进入Programming版参与讨论
相关主题
一个关于Insight debugger的问题GCC 居然允许变量长度的向量
问一个关于copy constructor的菜鸟问题。。。。。 (转载)a question about CGI
这个是什么原因全局对象
请问c++为什么会编译失败?谁给解释下这个比较弱的问题?
fork(): why both if and else are executed?一个简单的算法问题?
A thread questionint64_t printf
[转载] 简单的题都不敢做了.问一道C++的题目。 (转载)
little endian vs big endianQuestion on using ## in #define
相关话题的讨论汇总
话题: question话题: pid话题: nchild话题: sleep