Do you have any idea what functions to use in standard library to replace these Win32 functions (GetPrivateProfileInt and GetPrivateProfileString)?

Thanks! :)

Recommended Answers

These are Windows specific functionis related to INI files which are Windows Configuration files, so there couldn't be any standard function.

Jump to Post

you can write your own functions to replace them. ini configuration files are nothing more than simple text files that are in the format

[tag name]
<field> = <value>

So the program you write just searches for the tag name then the field and value.

Jump to Post

All 7 Replies

Member Avatar

These are Windows specific functionis related to INI files which are Windows Configuration files, so there couldn't be any standard function.

you can write your own functions to replace them. ini configuration files are nothing more than simple text files that are in the format

[tag name]
<field> = <value>

So the program you write just searches for the tag name then the field and value.

I actually found an open source that corresponds to the functions that I mentioned.

here's the link: http://www.matteolucarelli.net/libreria/GetPrivateProfile/GetPrivateProfile.c.htm

Now my problem is, I need to insert wchar_t* instead of the char* datatypes for the parameters. This version of the function is using standard lib functions which only accepts the datatype char*. Any suggestion on how to or what to do?

since you have the source code you can change it however you want. But ini files themselves are not usually UNICODE so you might have to add a little code to convert from wchar_t* to char*, assuming that is even possible, which it might not be with some languages.

Uhmmm. What if I will use wcstombs() function to convert wide char to multibyte? Could it be possible?

Yes, I use that function frequently and it works well for me.

Thank you sirs! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.