fstream problem (or it's the vector?)
Look at this piece of code please:
Code:
......
......
int main(int argc, char* argv[])
{
vector<char*> Elibdat;
fstream Efs, Sfs, sfs, ofs;
Efs.open("Elib.txt", ios::in);
......
......
// load the words in the "Elib.txt" file into the vector
while(true)
{
char wrds[20] ;
Efs>>wrds;
if(!strcmp(wrds, "\0")) break;
Elibdat.push_back(wrds);
}
......
......
// compare a text string with all the strings stored in the vector
int vecindex=0;
while(vecindex != Elibdat.size())
{
if(!strcmp(wrdsrc, Elibdat.at(vecindex))) //?
{
found=true;
break;
......
}
vecindex++;
......
......
}
The program stores text strings found in "Elib.txt" file, in a vector.
Elib.txt file looks something like this:
The
Truth
Is
Out
There
....
.....
......
The problem is that, at the if-statement where I've put an question mark, Elibdat.at(vecindex) does not return anything. And the VC++s' variables window indicates that there is nothing inside the vector, after the storing. Does anyone know why is that, please?
Thanks.