-
Using .txt files
I understand how to open text files, and how to close them. But not use the bit inside so to speak.
Can any one give me a quick run down on how to edit code inside, and use an if statement to check if a string is equal to any of the data within the text file.
-
You need to read some tutorials. I would start here.
-
I'm not 100% sure if I remember this correctly... but here goes:
Code:
fstream FileIn;
FileIn("Text.txt"); //Something like that
char szLine[MAX_PATH];
for (int i = 0; !FileIn.eof(); i++)
{
FileIn.getline(szLine, MAX_PATH);
/*I think I forgot something in here. This is now you get a line of text from a text file*/
if (strcmp(szLine, "Compare Text To") == 0)
MessageBox(NULL, "Line Matches", "MessageBox", MB_OK);
}