Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
簡単なコンソール関数を作成し、freopenを使用してprintfステートメントをファイルにリダイレクトします。ファイルへの出力を「オフ」にして、コードの後半でprintf出力をコンソールウィンドウにリダイレクトすることはできますか?
fprintf特定のファイルストリームに印刷できます。例えば、
fprintf
fprintf(stdout, "message");
message標準出力(コンソール)で印刷するので、ご覧のとおり、printfはの特殊化にすぎませんfprintf。
message
printf
これがお役に立てば幸いです。