Ayuda
tengo este error al ejecutarlo (compila bien) en ubuntu: terminate called after throwing an instance of 'std::ios_base::failure'
what(): basic_ios::clear
vector<int> Leer ()
{
vector<int> elementos;
int dato_numero;
char dato_string[8];
char *dato_char;
ifstream archivo;
archivo.exceptions(ifstream::eofbit | ifstream::badbit | ifstream::failbit | ifstream::goodbit);
archivo.open("moving.in");
if (archivo) {
while (!archivo.eof()) {
archivo.getline(dato_string,8);
dato_char = strtok (dato_string," ");
while (dato_char != NULL) {
dato_numero = atoi(dato_char);
elementos.push_back(dato_numero);
dato_char = strtok (NULL, " ");
}
cout << "HI";
}
archivo.close();
return elementos;
}
else
{
cout << "No se puede abrir el archivo";
}
}
what(): basic_ios::clear
vector<int> Leer ()
{
vector<int> elementos;
int dato_numero;
char dato_string[8];
char *dato_char;
ifstream archivo;
archivo.exceptions(ifstream::eofbit | ifstream::badbit | ifstream::failbit | ifstream::goodbit);
archivo.open("moving.in");
if (archivo) {
while (!archivo.eof()) {
archivo.getline(dato_string,8);
dato_char = strtok (dato_string," ");
while (dato_char != NULL) {
dato_numero = atoi(dato_char);
elementos.push_back(dato_numero);
dato_char = strtok (NULL, " ");
}
cout << "HI";
}
archivo.close();
return elementos;
}
else
{
cout << "No se puede abrir el archivo";
}
}
