I have one bug with my memory usage. I'm doing this:
Code:
char * szBuffer=(char*)malloc(200);
...
LPDWORD lpNumberOfBytesRead=new unsigned long;
if(ReadFile(hFileRead,szBuffer,sizeof(szBuffer),lpNumberOfBytesRead,NULL)==0){
ErrorHandler("Could Not Read File"); //process error
}else{//.....
basically evertime i fire up the program and go through the motions, i get my error of "could not read file" and debug says it has to do with szBuffer...what am I doing wrong here? As a side note: i wasn't using malloc() before...i thought it would solve my problems, before i was doing something like this:
Code:
char * szBuffer=new char[200];
but i found that it is cleaner to use malloc() (and free()) i actually made it farther through the program without it crashing (one line or so, so i believe the error occurs when i'm using szBuffer, not when it's declared). thanks for any help.