Hello all,
Thanks in advance for your help! I am writing a program to read a file and check if there is word in it.
A part of the text file looks like this:
Why are you using FILE pointers, character arrays, sprintf(), and fgets() in a C++ program. You really should be using std::string, stringstream, C++ streams.
The program's main purpose is to check whether there is a word in a certain file, not just a certain word like "P1"
1 2 3 4
FILE *pFile; // File handle
char c; // Where every character will be loaded from a file via fread() - use fread() instead
char strBuf[number_character_raw]; // A place to store the "potential" word if found
bool P1flag = false; // May not be needed in future, for debugging purpose only