13.2.cpp

来自「c入门代码大全」· C++ 代码 · 共 35 行

CPP
35
字号
# include <stdio.h>
# include <stdlib.h>
int main()
{

  FILE *in , *out ;
  char ch ,infile[10] , outfile[10] ;
  printf("enter the infile name:\n") ;
  scanf("%s" , infile) ;
  printf("enter the outfile name:\n") ;
  scanf("%s" , outfile) ;
  if((in = fopen(infile , "r"))==NULL)
    {
    
      printf("cannot open file\n") ;
      exit(0) ;
    
    }
  if((out = fopen(outfile , "w"))==NULL)
    {
    
      printf("cannot open the file\n") ;
      exit(0) ;
    
    }
  while(! feof(in))
   fputc(fgetc(in) , out) ;
  fclose(in) ;
  fclose(out) ;
  getchar();
  getchar();
  return 0 ;

}

⌨️ 快捷键说明

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