954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Win32 vs standard library functions

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

Thanks! :)

jaepi
Practically a Master Poster
647 posts since Jul 2006
Reputation Points: 32
Solved Threads: 4
 

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

vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
 

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.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

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?

jaepi
Practically a Master Poster
647 posts since Jul 2006
Reputation Points: 32
Solved Threads: 4
 

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.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

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

jaepi
Practically a Master Poster
647 posts since Jul 2006
Reputation Points: 32
Solved Threads: 4
 

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

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Thank you sirs! :)

jaepi
Practically a Master Poster
647 posts since Jul 2006
Reputation Points: 32
Solved Threads: 4
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You