ReadFile weird behavior when buffer is CString

Remove the address operator:

bResult = ReadFile(hCom, inBuffer.GetBuffer(1), 1, &nBytesRead, NULL);

Also: Don’t forget the matching call to ReleaseBuffer. And for adding that character

allData += inBuffer;

should be sufficient.

Leave a Comment