首页 > 代码库 > debug assertion failed

debug assertion failed

vs2008 调试报错

 

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
FILE *fp,*ofp;
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);
else{
if((ofp=fopen(*++argv,"a+"))==NULL)
printf("cat:can‘t open %s\n",*++argv);
else
filecopy(fp,stdout);
//fclose(fp);
}
}

void filecopy(FILE * ifp,FILE * ofp)
{
int c;
while((c=getc(ifp))!=EOF)
putc(c,ofp);

}