Jump to content
  • Advertisement

Archived

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

meselfs

Writing to an ini

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

Hi, I need to read/write flaots to an ini. There''s a function called GetPrivateProfileInt, but the problem is that it gets an int, not a float. Like a good n00b, I searched the forum before posting, and someone had written a function just for that. Here it is, slightly modified by me:
double GetPrivateProfileFloat(const char *section,const char *key,double def_value,const char *filename) //From gamedev.net forums.

{
    char buffer[64];
    if(GetPrivateProfileString(
	section,
	key,
	"",
	buffer,
	sizeof(buffer),
	filename
    )) {
	return atof(buffer);
    }
    else {
	return def_value;
    }
}
What I need is WritePrivateProfileFloat. I''ve messed with it for half an hour or so... anyone know how to accomplish this?

Share this post


Link to post
Share on other sites
Advertisement
Here's my suggestion: Don't use INI files. They lack finesse in representing certain types of information.

Yes, this is a shameless plug for my Config Parser library. It allows persistence of bool, int, float and strings as well as composition of arbitrarily more complex objects.

Regards,
Jeff


[ CodeDread ]

[edited by - rypyr on June 4, 2004 4:05:13 PM]

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!