奇怪的现象!
//a.txt文件内容:121010
0.123456
int main()
{
ifstream inFile2("a.txt", ios::binary);
ofstream outFile("b.txt", ios::binary);
while(!inFile2.eof())
{
int I; double D;
inFile2.read((char*)&I,4); outFile.write((char*)&I,4);
inFile2.read((char*)&D,8); outFile.write((char*)&D,8);
cout < <I < <" " < <D < <endl;
}
inFile2.close();outFile.close();
}
//屏幕输出:808530481 6.37257e-067 //问题1:为何输出两行??
909456435 6.37257e-067 //问题2:为何输出I,与D不是121010与0.123456?
//b.txt被写入: //原来的a.txt为:
121010 //121010
0.123456 //0.123456
0.12
//问题3:为何b.txt多输出一个空行,由多出一个0.12?