• Advertisement

Archived

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

How can I fwrite...

This topic is 5535 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
thats what I''m talking about... how do I save the data a pointer is pointing to?

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
Thanks... And to fread that back in, I''d use a pointer to the pointer (BYTE *data; fread(&data ... ) ) ?

Share this post


Link to post
Share on other sites

  • Advertisement