Sign in to follow this  
Tispe

GetPrivateProfileInt - generation of ini file

Recommended Posts

Hi

I wish to use a .ini file to store values such as resolution, windowed mode etc. Does the GetPrivateProfileInt generate an ini file if it does not exist, or do I need to do that with CreateFile myself?

Also, if GetPrivateProfileInt does not find the key it is looking for, it takes the default. But does it update the ini file with the new default key?


I want my application to be able to generate a new ini file if it is missing, populating it with sections and keys with defaulted values at start up.

Share this post


Link to post
Share on other sites
Do you really need a .ini file? From the doc:

Note This function is provided only for compatibility with 16-bit Windows-based applications. Applications should store initialization information in the registry.

Share this post


Link to post
Share on other sites
Hi Tispe!

I recommend that you write your own config file. Step on the. ini -extension to conveniently associate the file type with notepad on windows, or use a different extension.

Create a simple parser, and don't delve into how anyone thinks you should be doing it. Chances are they'll deprecate it soon anyway.

You can learn much from parsing, - and using files on relative paths rather than utilizing the windows registry means portability for your application.

Sorry for not actually answering your question. ;)

Share this post


Link to post
Share on other sites
I always hate these windows functions that take wide chars. I get all kinds of compiler errors relating to LPCWSTR. I need to add 5 lines of code for each function call just to do conversion.......

Why aren't there a "WritePrivateProfile[b]Int[/b]"??? Edited by Tispe

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this