GetPrivateProfileString Function
Garry B.
Tucson, AZ

Aug 18, 2012
3 Posts

GetPrivateProfileString function

There doesn't seem to be any examples of using GetPrivateProfileString in the ComChat example and I can't get the function to work even when I paste it into ComChat and use the same INI file. Is there a working example somewhere?


Garry Brunenkant

Solution Available
John K.

Aug 19, 2012
55 Posts

Re: GetPrivateProfileString function

hi garry!

i may not be the proper person to reply to you, but i had problems with this function too and i want to tell you how i fixed it, maybe this will help you too.

sEtdb = "abcdefghij"

getprivateprofilestring("global", "extern_db",sEtdb,sEtdb ,5, m_initfile)

in the above example, i am reading the key "extern_db" under the "global" section from the file with its path stored in the "m_initfile" variable.
the key value is read and placed within the "sEtdb" string variable.

this doesn't work if i don't initialize the string variable as in the example above (sEtdb = "abcdefghij", for example). if you don't want to initialize it this way, you can declare a size for the string when you declare the variable (under the variables section of the module or of the function itself. ex. sEtdb      string:10).

so it is mandatory to specify a size for this string variable in a way.

i hope this solves your issue.

best regards,

john k.

Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]