title: GetPrivateProfileStringA() cutting off my config value number
body: <p>I am calling the method <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms724353(v=vs.85).aspx" rel="nofollow" title="GetPrivateProfileStringA&#40;&#41;">GetPrivateProfileStringA()</a> in order to read values from a config.ini file, but when one of my values is over 3 digits, it cuts the value down to 3 (1234 would become 123).</p>
  
  <p>I have a config.ini file which looks like this:</p>
  
  <pre><code>[PASSPORT]
  MinWidth=200
  MinHeight=300
  
  [FEATURES]
  MinEyeDistance=20
  MaxEyeDistance=1000
  ...
  </code></pre>
  
  <p>I am reading this config.ini file using the following code:</p>
  
  <pre><code>char iniFilename[] = "C:\\config.ini";
  char *iniVal = new char[256];
  
  //check config.ini exists
  if (std::ifstream(iniFilename))
  {
      GetPrivateProfileStringA("PASSPORT", "MinWidth", "200", iniVal, sizeof(iniVal), iniFilename);
      configParam-&gt;minImageWidth = atol(iniVal);
      GetPrivateProfileStringA("PASSPORT", "MinHeight", "300", iniVal, sizeof(iniVal), iniFilename);
      configParam-&gt;minImageHeight = atol(iniVal);
  
      GetPrivateProfileStringA("FEATURES", "MinEyeDistance", "10", iniVal, sizeof(iniVal), iniFilename);
      configParam-&gt;minEyeDist = atol(iniVal);
      GetPrivateProfileStringA("FEATURES", "MaxEyeDistance", "1000", iniVal, sizeof(iniVal), iniFilename);
      configParam-&gt;maxEyeDist = atol(iniVal);
  }
  </code></pre>
  
  <p>The buffer string itself (iniVal) gets 3 digits only, so I don't believe it has anything to do with converting the value to a long.</p>
  
  <p>This is my configParam struct:</p>
  
  <pre><code>typedef struct _CONFIG_PARAMS
  {
      long minImageWidth;
      long minImageHeight;
      long minEyeDist;
      long maxEyeDist;
  } STRUCT_CONFIG_PARAMS;
  </code></pre>
  
  <p>I'm kind of lost as to why this is happening. Any help is appreciated!</p>