Hola, esto deberia devolver true si existe el archivo, y false si no existe, pero siempre devuelve true, ¿por que?
bool existe(){
fstream ok;
char texto[200];
ok.open("C:\\thanks.txt", ios::in); // Comprueba si existe thanks.txt
ok >> texto; // Leo una primera linea
if (!ok.eof()){
ok.close();
return false;
}
else{
ok.close();
return true;
}
}
127 C:\Users\*\Desktop\*\main.cpp [Warning] the address of `bool existe()', will always evaluate as `true'
EDITO: funciona perfectamente, el problema estaba al llamar a la funcion.
disculpad las molestias