0

因此,我尝试使用 ifstream 读取 .xls 文件,并且可执行文件返回一个难以理解的字符串。

我的功能如下

void submenuP(){
 ifstream ifile;
 ifile.open("C:\\Users\\VDSCH\\Desktop\\Productos\\Peluches\\Modelos.xls", ios::in);
    ifile.exceptions(ifstream::badbit | ifstream::failbit);

    string s;
    int c;

system("CLS");
if (!ifile){
    cerr<<"file not found"<<endl;
      exit(1);

}


cout<<"\n\n\t Lista de Peluches\n";
while(!(ifile>>ws).eof()){
    ifile>>s;
    if(ifile.fail()) exit(1);
    cout<<s<<endl;
}

ifile.close();
}

该函数应该只显示文件的内容,但它返回:

     Lista de Peluches
╨╧αí▒

我的函数有问题还是编译器有问题,我在 mingw for windows 中使用 g++ 并且最近更新了库

提前致谢

4

0 回答 0