#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
FILE *fp;
int i=7;
char *s,m[20]="hello\0";
fp=fopen("student.txt","r+");
if(fp==NULL){
printf("empty!!");
}
else{
printf("file has been open\n") ;
fputs("youcan",fp);
fprintf(fp,"%d",i);
fgets(m,2,fp);
printf("%s",m);
fclose(fp);
}
return 0;
}
这样我运行就没有输出,但是如果我注释掉写入文件的部分,就能正常文件输出
大大叶5529
SapereAudor
相关分类