我想将系统调用的输出重定向到文件中..我试过这个..
#include <stdio.h>
int main()
{
system("ls >> temp.txt");
return 0;
}
但这仅适用于系统调用..如果我用其他东西代替ls
,错误输出不会重定向到文件中..它只是打印在console
..
例如
#include <stdio.h>
int main()
{
system("hello >> temp.txt");
return 0;
}
我希望将错误输出重定向到文件..我该怎么做?谢谢..