confcopy.c

来自「文件名:c语言深入学习必备参考例子 很多经典的c例子:高级的宏定义」· C语言 代码 · 共 24 行

C
24
字号
#include <stdio.h>

void main(void)
 {
   FILE *input, *output;

   int letter;

   if ((input = fopen("\\CONFIG.SYS", "r")) == NULL)
     printf("Error opening \\CONFIG.SYS\n");
   else if ((output = fopen("\\CONFIG.TST", "w")) == NULL)
     printf("Error opening \\CONFIG.TST\n");
   else
     { 
       // Read and write each character in the file
       while ((letter = fgetc(input)) != EOF)
         fputc(letter, output);

       fclose(input);     // Close the input file
       fclose(output);    // Close the output file
     }
 }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?