方法1
#include <stdio.h>
int main(){
FILE * fd= fopen("/home/llc/abc.txt","w");
fprintf(fd,"hello\n");
fflush(fd);
fclose(fd);
return 0;
}
方法2
#include <stdio.h>
int main(){
FILE * fd= fopen("/home/llc/abc.txt","w");
for (int i = 65; i < 65+26; ++i) {
fputc(i,fd);
printf("%c\n", i);
}
fclose(fd);
return 0;
}
网友评论