【发布时间】:2013-03-18 02:45:28
【问题描述】:
当我使用这段代码时
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],它被设置为函数中的参数之一)
如果我写
This is a test
This is a test
为了测试它是否可以写多行,它写了这个
This is a test
This is a testThis is a test
This is a test
为什么会出现这种奇怪的行为?
【问题讨论】: