Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对此有一个小问题:
{ printf ("abc"); execl("./prog","prog",NULL); }
一切正常,但为什么execl只是在之前运行printf?有人可以帮助我吗?
execl
printf
实际上确实首先printf运行,但是它的输出是缓冲的。
您可以通过\n在字符串末尾添加换行符 () 或调用来刷新缓冲区fflush(stdout):
\n
fflush(stdout)
printf("abc\n");
或者:
printf("abc"); fflush(stdout);