#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