Witam! Tutaj mam sobie prostą funkcję (dla mnie nie, ale dla Was pewnie tak):
string LoadDifLang(int ID){
ostringstream TmpSS;
TmpSS<<ID;
string id = TmpSS.str();
ifstream stream("Text.lang");
if(!stream){
SetConsoleTextAttribute(hl, 13-1);
cout<<"Cannot find file with text!";
SetConsoleTextAttribute(hl, 8-1);
exit(0);
}
string IdFromFile;
bool Found=true;
do{
getline(stream, IdFromFile, ' ');
Found = !IdFromFile.compare(id);
}while(Found||stream.eof());
if(Found!=false) { //Found != false it means Found==false
SetConsoleTextAttribute(hl, 13-1);
cout<<"Error! Cannot find the correct text\nBlad! Nie mozna znalezc poprawnego tekstu!"<<endl;
SetConsoleTextAttribute(hl, OtherColor);
stream.close();
return "-Error!-";
}
else{
string Text;
getline(stream, Text, '\n');
stream.close();
return Text;
}
}
No i problem jest w tym, że wyrzuca błędną wartość. Zamiast It works! to works!" //To omijane cudzyslowow omine
Tutaj jak to wygląda w pliczku:
1 "It works!"
2 "cos"
...
Nie wiem co może być przyczyną :/