Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

GetPrivateProfileInt - generation of ini file


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Tispe   Members   -  Reputation: 368

Like
0Likes
Like

Posted 12 September 2012 - 10:49 AM

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.

Ad:

#2 Faelenor   Members   -  Reputation: 370

Like
0Likes
Like

Posted 12 September 2012 - 12:09 PM

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.

#3 SuperVGA   Members   -  Reputation: 839

Like
0Likes
Like

Posted 12 September 2012 - 12:18 PM

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. ;)

#4 Tispe   Members   -  Reputation: 368

Like
0Likes
Like

Posted 12 September 2012 - 02:10 PM

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 "WritePrivateProfileInt"???

Edited by Tispe, 12 September 2012 - 02:14 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS