0
我想問爲什麼我必須使用&緩衝區,而不是緩衝區,爲什麼我傳遞地址重新解釋轉換或類型轉換。謝謝。DWORD char *轉換
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));
}
的'read'和'write'方法需要一個指向的內存來存儲/檢索數據,所以你必須通過buffer'的'地址。 –
OT:http://stackoverflow.com/questions/5605125/why-is-iostreameof-inside-a-loop-condition-considered-wrong – Barmar