文件读取实现cat

#include <stdio.h>
  
int main(int argc,char* argv[])
{
        FILE* fp;
        char ch;

        //printf("number of argc is %d
",argc);
        if((fp=fopen(argv[1],"r"))==NULL)
        {
                printf("Fail to open file!
");
                return 0;;
        }

        while((ch=fgetc(fp))!=EOF)
        {
                putchar(ch);
        }
        printf("
");
        return 0;
}
sudo g++ fileDemo.cc -o fileDemo.exe

无情的摸鱼机器
原文地址:https://www.cnblogs.com/wangtianning1223/p/14837856.html