Jump to content
  • Advertisement

Archived

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

murdoc

How to save data to file?

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

I''am converting one fileformat to other. And i use fwrite() for saving but it doesn''t work. Could you help me? Please!!!

Share this post


Link to post
Share on other sites
Advertisement
try thist example. you could you also fprintf.

void Write(void)
{

FILE * pFile;
char buffer2[8]="try this";
fwrite (buffer , 1 , 8 , pFile);
fclose (pFile);
}

Visit my web site www.web-discovery.net !

Share this post


Link to post
Share on other sites
3 problems I see right away

void Write(void)
{

FILE * pFile;
char buffer2[8]="try this"; // the buffer2 is too small it needs to be longer for the NULL char at the end of the string
// next you need to actually open the file and have a FILE pointer
// pfile = fopen(buffer2,"wt");

// what the hell is ''buffer'' What happened to ''buffer2'' ??
fwrite (buffer , 1 , 8 , pFile);
fclose (pFile);
}

You are just typing, not programming.
Find a book that covers the basics. I''ve programmed as a hobby for 3 or 4 years and I still use one.

ZoomBoy
Developing a iso-tile 2D RPG with skills, weapons, and adventure. See my old Hex-Tile RPG GAME, character editor, diary, 3D Art resources at Check out my web-site

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!