开发者

how to force to redirect the message on the screen?

I am running a C++ program and there are other underling code.

When I run it, suppose it is a.exe, there are a lot of information printed on the screen. I can't redirect some inf开发者_StackOverflowormation to a .txt file like ./a.ext > temp.txt

How can I force it is redirect to the temp.txt?

Thanks!


POSIX

Reditect STDOUT and STDERR

./a.ext &> temp.txt

Or you can use equivalent from windows format.

./a.ext >& temp.txt

Windows (Reditect STDOUT and STDERR)

Reditect STDOUT and STDERR

./a.ext >& temp.txt

More information about this you can find at Using command redirection operators at Microsoft Technet


Some of the information may be written stderr. In order to catch both stdout and stderr, you should use

./a.ext > temp.txt 2>&1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜