I have a small file, I go over it and count the number of bytes in it:
while(fgetc(myFilePtr) != EOF)
{
numbdrOfBytes++;
}
Now I allocate virtual memory of the same size:
BYTE* myBuf = (BYTE*)VirtualAlloc(NULL, numbdrOfBytes, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
I now want to copy the content of my file into nyBuf. How do I do it?
Thanks!
In outline:
this assumes that the buffer is big enough to hold the contents of the file.