tags:

views:

67

answers:

1

I want to write a *.ini file in MFC. I know those typical methods with section names, key names and key values.

I`m wondering how to write a ini file which contains only a section name, an ini file like below:

...
[section]
...

I tried the function WritePrivateProfileString() with two NULL parameters; I thought it would work but failed.

A: 

Standard ini files are supposed to be in a special format, if you're writing them in a incompatible format (which I think you are), they're not standard ini files, but you can just write it manually using normal IO classes (CStdioFile or similar, too long since I did MFC so I can't remember the best way).
That way you can write any data you want in any format you want.

ho1
umm...i just found out that i could just use wirteprivateprofilesection() with a null string to make it...thank you anyway~