Functions that provide output in `szOut` require the string to be pre-dimensioned to the required length PLUS one extra for the NUL-terminating byte. The functions return the total length of the string they tried to create. Passing a NULL `szOut` or zero `nOutChars` will return the required length of the output string in bytes EXCLUDING the NUL-terminating byte, so remember to add one if allocating memory in C. The length is correct for VB6. All output is UTF-8 encoded.
For example:
long nChars; char *lpszOut; // Find out how many bytes we need nChars = SAT_MakePipeStringFromXml(NULL, 0, xmlfile, 0); if (nChars <= 0) error(); // Pre-dimension, i.e allocate memory for string buffer lpszOut = malloc(nChars+1); // NB +1 if (!lpszOut) error(); nChars = SAT_MakePipeStringFromXml(lpszOut, nChars, xmlfile, 0); //...