Hey!
Alright, I am working a program in C++ (obviously ;P).
I have been working on this game a very long time and took a break from it. I actually forgot how this line works:
vector<string> sWords(1);
int a = 0;
ifstream myfile("words.txt");
if(!myfile) {
cout << "Error opening words.txt\n";
system("PAUSE");
}
while(!myfile.eof()) {
[B]getline(myfile,sWords[a],' ');[/B]
a++;
sWords.resize(a+1);
}
So what that does is that it reads words.txt and puts every word into a vector (the words are separated with a space). But I have completely forgotten how the bold text works...
I have found a lot of information of getline with google but I can't get a good explanation of how this works. I mean, it finds the spaces between the words and puts them into a vector?