• 微信公众号:美女很有趣。 工作之余,放松一下,关注即送10G+美女照片!

c语言 13-13

开发技术 开发技术 2天前 4次浏览

????

#include <stdio.h>

int main(void)
{
    int ch;
    FILE *sfp;
    FILE *dfp;
    char sfile[FILENAME_MAX];
    char dfile[FILENAME_MAX];
    printf("source file name: "); scanf("%s", sfile);
    printf("destinatiom file name: "); scanf("%s", dfile);
    
    if((sfp = fopen(sfile, "rb")) == NULL)
        printf("aSfile open failed.n");
    else
    {
        if((dfp = fopen(dfile, "wb")) == NULL)
            printf("aDfile open failed.n");
        else
        {
            int n;
            while((n = fread(&ch, sizeof(int), 1, sfp)) > 0)
            {
                fwrite(&ch, sizeof(int), 1, dfp);
                fclose(dfp);    
            }
        }
        fclose(sfp);
    } 
}

 


程序员灯塔
转载请注明原文链接:c语言 13-13
喜欢 (0)