Archived

This topic is now archived and is closed to further replies.

Muzlack

How can I fwrite...

Recommended Posts

How can I fwrite a BYTE * ? Then how would I read it back? Cause when you fwrite something, you send a pointer to the object to the function, but when it''s already a pointer, what do you do?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
you can''t save pointers, well you can, it just won''t point to anything useful. You have to save the data its pointing to instead.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

  
BYTE* pdata = (BYTE*)malloc(5000);
FILE* fp = fopen("file.dat", "wb");
fwrite(pdata, 5000, 1, fp); // or fwrite(pdata, 1, 5000, fp);

fclose(fp);


Share this post


Link to post
Share on other sites