c语言文件类求助
小白在此 2014-01-29 01:11:03 这是我从书上敲下来的一个程序,
#include<stdio.h>
#include<stdlib.h>
int main(int argc,char *argv[])
{
FILE *fp;
void filecopy(FILE *, FILE *);
if(argc == 1)
filecopy(stdin,stdout);
else
while(--argc > 0)
if((fp = fopen(*++argv,"r")) == NULL){
printf("cat: can't open %s\n",*argv);
return 1;}
else
{
filecopy(fp,stdout);
fclose(fp);
}
return 0;
}
void filecopy(FILE *ifp,FILE *ofp)
{
int c;
while((c = getc(ifp)) != EOF)
putc(c,ofp);
}
说是一个将多个文件连接起来的cat程序,求大神给我讲解一下是怎么实现的,实现后是什么结果,难道新建了一个文件吗,而且点击运行后出现一个黑窗口,我该输入些什么?