That's what happens when you start picking from various snippets you find on the web and you really have no idea what you are doing.
Your code is awesome. I had sort of figure out what to do, but it took me about 20 lines to do what you did in just a couple. Someday, I might be able to do that. Thanks!
Let me follow up on this topic. Say I want to read the same file again, but this time, I want to look at every word on each line, and process each word. I can do it, by looping through each character on a line looking for spaces (the delimiting character) and using stringstreams and strings.
Is there a C++ function that will do this for me (kind of like the ignore function you showed me above)?
Here's what I have, which runs right after the code you suggested above:
1 2 3 4 5 6 7 8 9 10 11 12
//go back to the first line of the file
inFile.clear(); // clear error
inFile.seekg(0, ios::beg);
//read in each line and assign the edges
while(!inFile.eof())
{
inFile.getline(fileText, colWidth);
cout << fileText << endl; //take out later
//process each word here
}
inFile.close();