當前位置:編程學習大全網 - 編程軟體 - 編程實現 copy 命令,執行格式:copy file1 file2 file3 功能:將 file1、file2 兩文件的內容合並拷入 file3

編程實現 copy 命令,執行格式:copy file1 file2 file3 功能:將 file1、file2 兩文件的內容合並拷入 file3

int main(int argc, char *argv[])

{

char F1[20] = {0};

char F2[20] = {0};

char F3[20] = {0};

char ch;

FILE *pf1, *pf2, *pf3;

printf("intput the two source files name :");

scanf("%s %s",F1,F2);

printf("input the des file name: ");

scanf("%s",F3);

printf("%s %s %s",F1,F2,F3);

if(NULL == (pf1 = fopen(F1,"rb"))) return 0;

if(NULL == (pf2 = fopen(F2,"rb"))) return 0;

if(NULL == (pf3 = fopen(F3,"wb+"))) return 0;

while((ch=fgetc(pf1))!=EOF)

putc(ch,pf3);

while((ch=fgetc(pf2))!=EOF)

putc(ch,pf3);

fclose(pf1);

fclose(pf2);

fclose(pf3);

  • 上一篇:昆明有哪些好的技工學校
  • 下一篇:我是大三的學生,專業師範,我能考多少級的公***營養師?有什麽教材?什麽時候考試
  • copyright 2024編程學習大全網