Reading with function ReadFile

There's such code

1
2
3
4
5
6
7
8
9
10
  HANDLE File = CreateFile((LPWSTR)buf, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
			char cBufferText[] = "TTTTESTTTT";
			WCHAR writtenStr[128];
			DWORD HH;
			SetFilePointer(File, 0, 0, FILE_BEGIN);
			ReadFile(File, writtenStr, 128, &HH, NULL);
			MessageBox(hWnd, writtenStr, L"текст", MB_OK);
			WriteFile(File, &cBufferText, sizeof(&cBufferText)* 2 + 1, &HH, NULL);
			SetEndOfFile(File);
			CloseHandle(File);


WriteFile works, but ReadFile don't (it shows hieroglyphics). What's wrong there?
Last edited on
Topic archived. No new replies allowed.