// // File: FindWord3.cc // Author: Steven Ong // // Purpose: /** * I used this program as a 'try out' on Netbeans 6.0 * with Cygwin (GCC)3.4.4 on Win2k * Aso to review the pointer operation in C * */ //
if(inFile == NULL){ perror("File cannot be opened!"); exit(1); }
//reset the pointer to point to the begining of buff t = buff; do { c = fgetc(inFile);
// This necessary for it to work on MS-Windows // In Windows, the newline goes in pair "rn" // Pain! Pain! Pain! if (c == 'r'){ continue; } if (c == 'n'){
if (strcmp(buff, argv[1])== 0){ printf("found [%s] at line %dn", buff, line); } line++;
Write a program to find distinct word from a file
Profile Answers by bismitapadhy Questions by bismitapadhy
Questions by bismitapadhy answers by bismitapadhy