I am trying to use WriteFile
to write a simple text in a .TXT file. Here's my declaration:
// For WriteFile fuction
BOOL writeFile;
LPCVOID textToWrite = L"SakyLabs: Hello, MDE.";
DWORD numberOfBytes = (DWORD)wcslen(textToWrite);
DWORD numberOfBytesWritten;
numberOfBytes
was based on Microsoft's example from here.
Next, the WriteFile function:
writeFile = WriteFile(createFile, textToWrite, numberOfBytes, &numberOfBytesWritten, NULL);
I am getting createFile from a previous CreateFileW
call. Also, I am using Unicode functions.
WriteFile
works, but I only get this part of the text written in the file:
S a k y L a b s : H
What am I doing wrong?