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);