[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;
}

posted @ 2013-02-02 10:36  小尼人00  阅读(208)  评论(0编辑  收藏  举报