このコードを使用すると
FILE *f = fopen(file, "wb");
fflush(f);
if (f==NULL) {
//perror(f);
return 0;
}
else{
fwrite(text, sizeof(char), strlen(text), f);
int i = fprintf(f, "%s", text);
if (i>0) {
fclose(f);
return 1;
}
(text
はconst char text[1024000]
、関数の引数の1つとして設定されます)
This is a test
This is a test
複数の行を書き込むことができるかどうかをテストするために、これを書き込みます
This is a test
This is a testThis is a test
This is a test
なぜこの奇妙な振る舞いをするのですか?