WritePrivateProfileString

WritePrivateProfileString

Post by jacob navi » Wed, 27 Oct 2004 04:50:52


I have discovered a new property of the WritePrivateProfileString API.
If you write a string with quotes like:
"c:\program files\somepath\foo"
the API will NOT write the quotes to the INI file.

Ahhhh.

This explains why when doing a CTRL+F5 to execute a program in Wedit
the program would fail...
The only work around I discovered was to write
"\ "c:\program files\somepath\foo"

When I write the string I test if a quote is the first char.
If it is, I add a \ and a space before it, and I eliminate them
when I read it.

This is not documented as specified behavior. The docs tell
only that the TAB char is ignored, never mentioning anything
about quotes...

Well, you know now.

jacob
 
 
 

WritePrivateProfileString

Post by Jason Hoo » Fri, 29 Oct 2004 02:21:44


Yes it will, it's Get... that's stripping them. To include quotes in
the string requires doubling the quotes:

key="test" --> test
key=""test"" --> "test"

Jason.