⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filecopy.c

📁 C源码集
💻 C
字号:
#include <stdio.h>int main (){	char in_name[80], out_name[80];	/* with win 95 long filenames plus path names,		80 may not be big enough! */	FILE *instream, *outstream;	int ch;	printf("What is the source file name? ");	scanf("%79s", in_name);	/* %79s so only reads 79 chars and doesn't overflow the string		 in_name is name of array, ie is the address of the first element		 so don't need &in_name */	if((instream = fopen(in_name, "r")) == NULL)	{		fprintf(stderr, "open of %s for reading failed ", in_name);		perror("because");		return 1;	}	printf("What is the destination file name? ");	scanf("%79s", out_name);	if((outstream = fopen(out_name, "w")) == NULL)	{		fprintf(stderr, "open of %s for writing failed ", out_name);		perror("because");		return 1;	}	while ((ch = fgetc(instream)) != EOF)		fputc(ch, outstream);	fclose(instream);          //not strictly essentail but good practice	fclose(outstream);         // C closes files when it finishes	return 0;}

⌨️ 快捷键说明

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