【发布时间】:2014-07-31 05:42:34
【问题描述】:
当我运行以下程序时,system("ls -l") 的输出显示在printf 之前。为什么会这样?
#include<stdio.h>
int main()
{
printf("\nHello world");
system("ls -l"); // output of this statement is displayed before that of the preceding
// printf statement
return 0;
}
谢谢。
【问题讨论】:
-
system是一个库函数,而不是系统调用。为什么要在行首而不是行尾打印'\n'?