title: ::GetPrivateProfileString read whole section of INI file
body: <p>I'm modifying existing C++ application and moving out some values that are currently hard coded.</p>
  
  <p>I'm doing this with one class that will "manage" this whole thing and hold <code>map&lt;CString, CString&gt;</code> of the values from the INI file.</p>
  
  <p>Right now I have to read each value separately using <code>::GetPrivateProfileString</code> function  - can I somehow read whole section instead of single value?</p>
  
  <p>Prefer not to have to read the file manually, but if there's any reasonable (i.e. efficient + simple to use) existing way I'm open for suggestions.</p>
  
  <p>Edit: just now had to use it "for real" and the solution was indeed passing NULL as the <em>lpKeyName</em> value. Complete code including parsing the return value:</p>
  
  <pre><code>char buffer[MAX_STRING_SIZE];
  int charsCount = ::GetPrivateProfileString("MySection", NULL, NULL, buffer, MAX_STRING_SIZE, m_strIniPath);
  CString curValue;
  curValue.Empty();
  char curChar = '\0';
  for (int i = 0; i &lt; charsCount; i++)
  {
      curChar = buffer[i];
      if (curChar == '\0')
      {
          if (curValue.GetLength() &gt; 0)
              HandleValue(curValue);
          curValue.Empty();
      }
      else
      {
          curValue.AppendFormat("%c", curChar);
      }
  }
  if (curValue.GetLength() &gt; 0)
      HandleValue(curValue);
  </code></pre>
  
  <p>It's not trivial as it returns the keys separated by zero character (EOS?) so I had to extract them using loop such as the above - share it here for the sake of everyone who might need it. :-)</p>