1.write file
void outputFile(long time){
char buf[128];
int n=sprintf(buf,"%d",time);//write the content to buffer first!
buf[n]=0;
FILE *stream;
stream= fopen( "./time.txt", "w+b" );
fwrite(buf, 1,n, stream );
fclose(stream);
}
char buf[128];
int n=sprintf(buf,"%d",time);//write the content to buffer first!
buf[n]=0;
FILE *stream;
stream= fopen( "./time.txt", "w+b" );
fwrite(buf, 1,n, stream );
fclose(stream);
}
fwrite(buf, 1,n, stream );
buf: the content to write
1:the size of write per operation
n:the size of content