我想问为什么我必须使用 &buffer 而不仅仅是缓冲区,为什么我要传递地址来重新解释强制转换或类型转换。谢谢。
DWORD buffer;
std::ifstream openFile("xxxxx",std::ios::in|std::ios::binary);
std::ofstream writeFile("xxxxx",std::ios::out|std::ios::binary);
while(!openFile.eof())
{
openFile.read(reinterpret_cast<char*>(&buffer),sizeof(DWORD));
writeFile.write((char *)&buffer,sizeof(DWORD));
}