舊的內容不被消滅的內容。 數據正在被寫入,所以我仍然看到舊的內容。 我沒做什麼?的CreateFile/WriteFile的不摧毀舊文件
hFile = CreateFile(fname, // open testfile.txt
GENERIC_WRITE, // open for reading
0, // do not share
NULL, // default security
OPEN_ALWAYS, //
FILE_ATTRIBUTE_NORMAL, // normal file
NULL); // no attribute template
dwBytesToWrite = buff.GetLength();
WriteFile(hFile, buff.GetBuffer(100), dwBytesToWrite, &dwBytesWritten, NULL);
大衛,你是對的。我擔心重寫的問題,因爲這是OP正在經歷的。但是,我現在明白地看到它會覆蓋整個文件。我想刪除我的答案,但我不能,因爲它已被接受。 – 2012-01-07 20:14:26
我們走了。現在我將留下我的答案作爲未來用戶的注意事項*不* *採取我的方法,並且肯定*不*合併這些標誌,因爲MSDN特別說*不* *。 – 2012-01-07 20:27:38