I don't know what ErrorToString expects as arguments, but I'd say it is a char* representing a pointer to a buffer where it can store the result string.
In this case your code:
//Obtain error string
char* errorcode = new char;
ErrorToString(lngErrorcode, errorcode);
looks wrong (it is allocating a single char).
Try changing it to:
//Obtain error string
char* errorcode = new char[1024];
ErrorToString(lngErrorcode, errorcode);
and see if this works (in this case don't forget you need to release the memory later).
Hope this helps.