fflush( fp2 ) 刷新缓存,记得文件关闭
在我这可以
#include
#include
int main(void){
char* filename="backup.txt";
FILE *fp2 = fopen("backup.txt","w+");
time_t timep;
timep = time(NULL);
fprintf(fp2,"%s%s\n",filename,ctime(&timep));
}
:~/test$ vi backup.txt
backup.txtThu Aug 28 11:35:09 2014