Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i write an int value with WriteFile() ?

Status
Not open for further replies.

TDragon

Programmer
Jun 1, 2002
3
US
for some reason, the code I'm using to write to a file won't work when I put an int value in the buffer to be written. Here's my code:

WriteFile((HANDLE)info, (LPVOID)sprites[2].typenum, sizeof(int), &written, NULL);

sprites[] is an array of structs containing an int typenum.
info is an HFILE.
written is a DWORD.
So what's wrong?
 
Oh, and BTW when I try to show the error message with GetLastError(), it merely returns the number "87".
 
Error 87 means: The parameter is incorrect. It is my guess you should write (LPVOID)&sprites[2].typenum (with the &-character).

Marcel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top