Jump to content
  • Advertisement

Archived

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

Muzlack

How can I fwrite...

This topic is 5746 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
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!