title: Why am I getting this access violation?
body: <p>I'm probably doing something stupid here, but it's been a while since I've worked in C++ and for some reason I keep getting an access violation when sprintf is called. Anyways, here's the code I'm using:</p>
  
  <pre><code>char *value, *result;
  int len;
  result = "";
  mgr.GetObjValue(0, value, len);
  
  for (int i = 0; i &lt; len; i++) 
  {
    sprintf(result, "%s %X", result, value[i]);
  }
  
  printf("ObjVal: %s\n\n", result);
  </code></pre>
  
  <p>if anyone is curious what GetObjValue does, it just retrieves the SNMP object value from the API I am using. Here's it's declaration:</p>
  
  <pre><code>int SNMPMgr::GetObjValue(int iObjIndex, char *&amp;lpObjValue, int &amp;lenObjValue);
  </code></pre>
  
  <p>Any help would be much appreciated</p>