#include <stdio.h>
#include <malloc.h>
int main()
{
FILE *file;
char *filepath;
filepath = (char *) malloc( 50 * sizeof(char) );
printf("请输入选中的文件\n");
scanf("%s" , filepath);
if( NULL == ( file = fopen(filepath , "r") ) )
printf("该文件不存在");
else
{
FILE *file1;
char c;
char *filepath1;
filepath1 = (char *)malloc( 50 * sizeof(char) );
printf("请选择被复制的文件,如果没有将会创建.\n");
scanf("%s" , filepath1);
file1 = fopen(filepath1 ,"w" );
while ( EOF != ( c = getc(file) ) )
putc( c , file1 );
fclose(file1);
}
fclose(file);
}
linux c 基本输入输出函数库
最新推荐文章于 2024-07-15 19:45:07 发布