multiples of the sector size. That at least should be clear from
On Jul 2, 1:09 am, Tim Roberts <t...@probo.com> wrote:
How can we possibly know that without knowing what error you are getting?
There was nothing inherently wrong with the code you posted.
I apologize. When I use FormatMessage(...) and GetLastError(),
WriteFile(...) is returning:
"The parameter is incorrect." Seems ambiguous...
Unless, that is, you opened the file with FILE_FLAG_OVERLAPPED. If you
open a file overlapped, then EVERY I/O function must specify an overlap
structure.
I'm only opening the file with the FILE_FLAG_NO_BUFFERING flag.
Here's my current code snippet:
<SNIP>
// Write ASCII header to file.
sprintf_s(szTemp, sizeof(szTemp),
"MyData: Date:%s\r\n", szTimeStamp);
if (! WriteFile(
hWriteFile,
szTemp,
sizeof(szTemp),
&dwNumBytesWritten,
NULL) )
{
// Get the error message.
DWORD dwChars = FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_ALLOCATE_BUFFER,
0,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR) &lpszErr,
0,
0);
// Append it to the log.
pThis->UI->AppendToStatLog(lpszErr);
pThis->UI->AppendToStatLog("WARNING:
FileWriteThread - Writing header line 1 to file!");
}
</SNIP>