Hi, i have a problem with a vector.
I declare a vector<char*> moves; in header.
Code:
void LogView::init(){
int a = 0;
while (LogFile.good()){
LogFile.getline(line, 6);
moves.push_back(line);
cout << "vector :"<< moves[a]<< endl; // here is OK
a++;
}
moves.begin();
cout << "vektor :"<< moves[1]<< endl; // here is NOT OK
cout << "vektor :"<< moves[2]<< endl; // here is NOT OK
cout << "vektor :"<< moves[3]<< endl; // here is NOT OK
cout << "vektor :"<< moves.at(1)<< endl; // here is NOT OK
cout << "vektor :"<< moves.at(2)<< endl; // here is NOT OK
cout << "vektor :"<< moves.at(3)<< endl; // here is NOT OK
cout << "vektor :"<< moves.front()<< endl; // here is NOT OK
cout << "vektor :"<< moves.back()<< endl; // here is NOT OK
//AN ITERATION FOR IS NOT OK TOO.
cout << moves.size(); // IT'S OK!
}
}
Thank You.