The only two things I see that are guaranteed problems are first in EnterName(). You should input text using getline().
void WordRead::EnterName()
{
cout << "Type in the text file path you wish to read: ";
cin.getline( theFile, 1000 );
} And second inLoadFile(), your loop will never terminate if you never hit EOF (which can happen if a read error occurs). A better idiom is to terminate if the istream indicates any failure.
for(int i = 0; myFile.good(); i++) But you've also got another problem. Even if you hit EOF, you still try to add a character to the end of your vector. As an added note, using the class variablech is much slower than using a local char variable. Below I suggest something better for you.
You should really consider making use of the STL string library. That will make things much easier, and you'll get better performance than a vector of char.
I think you need to work on your variable names also... Variables should be nouns, and functions should be verbs. Both should be descriptive of what it represents.
...
#include <string>
...
private:
// This is more descriptive: it tells you it is the
// file's -name-, and not some other thing.
string theFileName;
// Fine
ifstream myFile;
// Again, this tells you that it is the file's text.
// 'load' is a verb, and is doubly confusing when
// used anywhere other than in LoadFile().
// (It is confusing there too, though..)
string theFilesText;
...
void WordRead::EnterName()
{
cout << "Type in the text file path you wish to read: ";
getline( cin, theFileName );
}
void WordRead::LoadFile()
{
char c;
myFile.open(theFileName);
for (streamsize i = 0; myFile.get( c ); i++)
{
theFilesText.push_back( c );
cout << "char " << i << << ": " << c << '\n';
}
myFile.close();
} I use '\n' instead of endl because the second forces a flush every time, while the first only flushes whencout thinks it is a good time. This will make your file load much faster also.
Whew. Nice use of classes, and you seem to have a good idea of structure. Hope this helps.