So I have writing to a file and reading from a file. Now I need to be able to find specific data that was previously entered and saved to that certain file. Here is the code I have so far.
{
ofstream myFile ("words.txt");
if (myFile.is_open())
{
myFile << dictionary.newWord();
myfile.close();
}
else cout << "Cannot open file";
}
{
string word;
ifstream myFile ("words.txt");
if (myFile.is_open())
{
while (! myFile.eof() )
{
getWord (myFile,word);
cout << word << endl;
}
myFile.close();
}
else cout << "Cannot open file";