Hi,
This is probably some basic knowledge but I haven't found it out.
I have this snippet of code that is causing me problems:
HANDLE hFile;
char lpBuffer[100] ="";
char idBuffer[100] = "";
DWORD ofs;
strcpy(lpBuffer, fingerprint);
strcat(lpBuffer,"\0");
hFile = CreateFile(buffer,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL);
WriteFile(hFile,lpBuffer,sizeof(lpBuffer), &ofs, NULL);
strcpy(buffer,"");
if(ReadFile(hFile, idBuffer, 100, &ofs, NULL))
printf("OK");
else
printf("NOTO OK");// Suppose there is more data to be read and GetLastError is IO_PENDING
printf("idBuffer = %s\n", idBuffer);
printf("¨fingerprint = %s\n", fingerprint);
It is just for test purposes since I can't get it working. Everything works fine except that ReadFile won't fill the idBuffer with any data from the file. The result code from ReadFile says OK so no problem there. If I open the file I can see the data but it is not picked up to variable idBuffer.
CreateFile and Write File seems to be working fine because I get the expected data in the file. And then again ReadFile does not read it....
I'm using Visual Studio 2005 if that is of any interest.
Anyone having the solution to this out there?
Regards,
Kalle