Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WritePrivateProfileString
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00128327
Message ID:
00128726
Views:
20
>>>I have the syntax for using GetPrivateProfileString to read and INI file does anyone have the info for WritePrivateProfileString to write to an INI file?
>>>
>>>Thanks
>>
>>From George Tasker's INI file class:
>>
>>DECLARE SHORT WritePrivateProfileString IN Win32API;
>> STRING cSection, STRING cEntry, STRING cString, STRING cFilename
>>
>>Use it to your hearts content, but George's class has so much functionality already built, I highly recommend downloading and using it directly.
>
>I downloaded it but I am having trouble using WritePrivateProfileString. It fails to write to the ini file. I get return codes of 1 and 0. Do you know what this means?
>
>Thanks

Hi John,

I use the convention of declaring Boolean return values as SHORTs in order to differentiate between logical and numeric values. This means that you can call the function like this:
llresult = (WritePrivateProfileString(lcsection, lcentry, lcvalue, lcfile) # 0)
As Ed mentioned, GetLastError() should return the last error condition, but there are only a handful of things that would cause this to fail, such as insufficient disk space.

In looking over my class, I think it's bad form on my part not to have the calls to these return a value to indicate whether or not the function succeed. I'll look into making some changes in this area, and if I decide to modify the class, I'll be sure to post it here.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform