[C/C++] C语言文件读写示例程序 xcb
#include <stdio.h> #include <stdlib.h> int main() { FILE *p, *q; char s[1000]; p=fopen("d:\\123.txt","r+"); q=fopen("d:\\1.txt","w+"); while(fscanf(p,"%s",s) != EOF) { printf("%s\n",s); fprintf(q,"%s\n",s); } printf("Hello world!\n"); return 0; }