INI File With Duplicate Keys

痞子三分冷 提交于 2021-01-28 08:22:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!