已知GetPrivateProfileString和WritePrivateProfileString两个API.并能简单运用.
如果现有一个ini文件内容简要如下:[sec1]
List=p1[sec2]
QQ=1188552现在已知ini文件有一项为"QQ",但不知道节点名称.请问怎么读取到QQ的项值?以及怎么读取到这个项所属的节点为"sec2"?

解决方案 »

  1.   

    If lpAppName is NULL, GetPrivateProfileString copies all section names in the specified file to the supplied buffer. If lpKeyName is NULL, the function copies all key names in the specified section to the supplied buffer. An application can use this method to enumerate all of the sections and keys in a file. In either case, each string is followed by a null character and the final string is followed by a second null character. If the supplied destination buffer is too small to hold all the strings, the last string is truncated and followed by two null characters.
      

  2.   

    如果lpAppName 等于0,你可以得到所有节的名字
    如果lpKeyName 等于0,你可以得到所有关键字的名字