我正在尝试读取大于 2GB(约 15GB)的 las 文件,但 ios::fail() 标志在第 345 个字节中变为真。这是下面的代码。
void Foo()
{
char* filename = "../../../../../CAD/emi/LAS_Data/AOI.las";
ifstream m_file (filename);
char c;
int count = 0;
if (m_file.is_open())
{
while ( m_file.good() )
{
m_file.get(c);
cout << c << endl;
count++;
}
// Check State
if(m_file.fail())
cout << "File Error: logical error in i/o operation." << endl;
if(m_file.eof())
cout << "Total Bytes Read: " << count << endl;
m_file.close();
}
else
{
cout << "File Error: Couldn't open file: " << endl;
}
}
输出是:
...
File Error: logical error in i/o operation.
Total Bytes Read: 345
我错过了什么?