1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
HANDLE fCreate;
DWORD bytesRead;
fCreate = CreateFile(fPath, GENERIC_READ, FILE_SHARE_READ, NULL, 3, FILE_ATTRIBUTE_NORMAL, NULL);
char *buffer = new char[(500 + 1)]{};
if (!fCreate)
buffer = "Failed to open file!";
SetFilePointer(fCreate, 0, NULL, FILE_BEGIN);
while(ReadFile(fCreate, buffer, 500, &bytesRead, NULL)) {
// Check is EOF reached
if (bytesRead == 0) {
delete[] buffer;
break;
}
MessageBox(NULL, buffer, "BUFFER", MB_OK);
}
|