I use the following code to read all the elements from a file with a descriptor hFilethat works and with its size that I got from GetFileSize(hFile, NULL).
_TCHAR* text = (_TCHAR*)malloc(sizeOfFile * sizeof(_TCHAR));
DWORD numRead = 0;
BOOL didntFail = ReadFile(hFile, text, sizeOfFile, &numRead, NULL);
after the operation, textthere is some strange thing in Japanese or something like that, and not the contents of the file.
What did I do wrong?
edit: I understand that this is a coding problem, but then how will I convert the text to LPCWSTR to use things like WriteConsoleOutputCharacter
source
share