私はデータを表示するためにコマンドラインを使用するスクリプトを作成しようとしています。コマンドラインに出力されたすべてのものを別々のファイルに記録する必要があります。C++でコマンドラインを記録する
私はfstream、iostream、およびstd名前空間を使用しています。私は、コマンドラインCmdExample.exeとそれをtxtファイルに書き込むためのすべてを参照する方法を知る必要があります。
例:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
cout << "This is some text I want to reference when the program ends" << endl << "and write to a txt file.";
return 0;
}
通常、 'CmdExample.exe> output.txt'を実行します。 – nwp
おそらく、https://stackoverflow.com/questions/24413744/using-operator-to-write-to-both-a-file-and-coutのようなものを探しています。 –