title: How to read ASCII control characters from INI
body: <p>I'm calling the following native API to read/write from INI files</p>
  
  <pre><code>[DllImport("kernel32.dll")]
  private static extern int GetPrivateProfileString(    // INI Read
          String section,
          String key,
          String def,
          StringBuilder retVal,
          int size,
          String filePath);
  [DllImport("kernel32.dll")]
  private static extern long WritePrivateProfileString(  // INI Write
          String section,
          String key,
          String val,
          String filePath);
  
  public string ReadIni(string sectionString, string keyString, string filePathString) 
  {
      StringBuilder temp = new StringBuilder(200000);
      int i = GetPrivateProfileString(sectionString, keyString, "", temp, temp.Capacity, filePathString);
      return temp.ToString();
  }
  
          // Write (Section, Key, Data, File Path)
  public void WriteIni(
  string sectionString, string keyString, string dataString, string filePathString) 
  {
      WritePrivateProfileString(sectionString, keyString, dataString, filePathString);
  }
  </code></pre>
  
  <p>Reading/Writing to ini files works well with the above code.</p>
  
  <p>When I try to read ASCII control chars, such as 0x02 (STX) and 0x03 (ETX), read function just returns an empty string. Writing the control characters works perfectly.</p>
  
  <p>Normally, I'd just avoid using native APIs to read/write into INI or better yet, avoid using ini files altogether, but this is a really old legacy application I'm fixing so that that I need to get this function to work in its current form.</p>
  
  <p>How can I make GetPrivateProfileString read ASCII control characters?</p>