问题
Say I have an INI file like so:
[123]
name=Ryan
name=Joe
How would I retrieve "name=Ryan\nname=Joe" using API calls such as GetPrivateProfileSection and GetPrivateProfileString?
回答1:
Yes, GetPrivateProfileSection will return it. GetPrivateProfileString() can obviously only ever retrieve "Ryan". You won't get the string handed to you like you want, the name/value pairs are separated by a zero. The end of the list is indicated by two zeros. You'll need to account for that when you parse it.
来源:https://stackoverflow.com/questions/4214689/ini-file-with-duplicate-keys