用ifstream 打开乱码的文件时,要用二进制的读取方式

ifstream ifstr(fn,ios::binary);

 

string line;

while( !ifstr.eof())

{

getline(ifstr,line);

len += line.length();

}

你可能感兴趣的:(ios,String)