分类: C/C++
2006-03-31 21:08:37
#include
#include
void usage(void);
int main(int argc, char* argv[])
{
int i;
FILE* in;
char ch;
if(argc != 2)
{
usage();
}
for (i=1; i
in = fopen(argv[i],"r");
if (in == NULL)
{
printf("Failed to open file %s\n", argv[i]);
return(0);
}
while ((ch = fgetc(in)) != EOF)
{
putchar(ch);
}
fclose(in);
}
return 0;
}
void usage(void)
{
printf("Usage:\n\n\t\t Cat:\n\n\t\tCat File");
}