// file: lecture_07/example.cc // // local include files // #include "example.h" // method: main // // main program starts here // int main(int argc, char** argv) { // open a file // bool status = false; FILE* fp = fopen(argv[1], "r"); if (fp == (FILE*)NULL) { fprintf(stdout, "hello world\n"); } long i = 0; char buf[999]; while (fgets(buf, 999, fp)) { fprintf(stdout, "%d: %s\n", i++, buf); } // close the file // fclose(fp); // exit gracefully // return(0); }