文件名称:1
介绍说明--下载内容来自于网络,使用问题请自行百度
文件的复制和追加。包括< stdio。h > # include < stdlib。h>#定义MAXLEN 80int main(void){file *fpSrc=NULL;文件* fpDst =零;char ch;char srcFilename[MAXLEN];char dstFilename[MAXLEN];printf("输入源文件名:”);scanf(“% s”,srcFilename);如果((fpSrc = fopen(srcFilename,“r”))= = NULL){ printf("不能打开文件% s ! \ n”,srcFilename);退出(0);} printf("输入目的地文件名:");scanf(“% s”,srcFilename);如果((fpDst = fopen(dstFilename,“w”))= = NULL){ printf("不能打开文件% s ! \ n”,dstFilename);退出(0);},((ch =获取(fpSrc))! = EOF){如果(fputc(ch,fpDst)= = EOF){ printf(“复制失败!”);退出(0);} } printf(“复制成功。\ n”);文件关闭(fpSrc);文件关闭(fpDst);返回0;(#include <stdio.h>
#include <stdlib.h>
#define MAXLEN 80
int main(void)
{
FILE *fpSrc=NULL;
FILE *fpDst=NULL;
char ch;
char srcFilename[MAXLEN];
char dstFilename[MAXLEN];
printf("Input source filename:");
scanf("%s",srcFilename);
if((fpSrc=fopen(srcFilename,"r"))==NULL)
{
printf("can't open file %s!\n",srcFilename);
exit(0);
}
printf("Input destination filename:");
scanf("%s",srcFilename);
if((fpDst=fopen(dstFilename,"w"))==NULL)
{
printf("can't open file %s!\n",dstFilename);
exit(0);
}
while((ch=fgetc(fpSrc))!=EOF)
{
if(fputc(ch,fpDst)==EOF)
{
printf("Copy failed!");
exit(0);
}
}
printf("Copy succeed.\n");
fclose(fpSrc);
fclose(fpDst);
return 0;)
#include <stdlib.h>
#define MAXLEN 80
int main(void)
{
FILE *fpSrc=NULL;
FILE *fpDst=NULL;
char ch;
char srcFilename[MAXLEN];
char dstFilename[MAXLEN];
printf("Input source filename:");
scanf("%s",srcFilename);
if((fpSrc=fopen(srcFilename,"r"))==NULL)
{
printf("can't open file %s!\n",srcFilename);
exit(0);
}
printf("Input destination filename:");
scanf("%s",srcFilename);
if((fpDst=fopen(dstFilename,"w"))==NULL)
{
printf("can't open file %s!\n",dstFilename);
exit(0);
}
while((ch=fgetc(fpSrc))!=EOF)
{
if(fputc(ch,fpDst)==EOF)
{
printf("Copy failed!");
exit(0);
}
}
printf("Copy succeed.\n");
fclose(fpSrc);
fclose(fpDst);
return 0;)
相关搜索: 文件的复制和追加
(系统自动生成,下载前可以参看下载内容)
下载文件列表
文件名 | 大小 | 更新时间 |
---|---|---|
1.docx | 13445 | 2018-04-07 |
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.