【发布时间】:2013-10-08 05:53:13
【问题描述】:
我在 Linux (Ubuntu) 中有一个 C++ 程序,它在命令终端中打印很长的输出。
如何通过 Linux 命令将命令终端的输出直接复制到 .txt 文件中?
【问题讨论】:
标签: c++ linux command-line
我在 Linux (Ubuntu) 中有一个 C++ 程序,它在命令终端中打印很长的输出。
如何通过 Linux 命令将命令终端的输出直接复制到 .txt 文件中?
【问题讨论】:
标签: c++ linux command-line
您的 shell 通过输出重定向为您执行此操作:
$ ./a.out > theoutput.txt
【讨论】:
一般你输入;
command > file.txt
大于号 > 将标准输出重定向到文件。
【讨论】:
stdout和stderr:command 1>outFile 2>errFile。