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.
ファイルストリームがあるとしましょう。
FILE *fp = fopen("hi.txt", "w"); fprintf(fp, "test");
どうにかしてもう一度開きたいのですが、空にしたいのですが、今回はファイル名にアクセスできません。以下のようにしてみましたが、出力は変わらないようです。
fp = freopen(NULL, "w", fp); fprintf(fp, "changed"); fflush(fp);
出力ファイルにはまだ「テスト」と表示されています。