Q3CString_GetString
You can use theQ3CString_GetStringfunction to get the character data of a C string object.
TQ3Status Q3CString_GetString ( TQ3StringObject stringObj, char **string);
stringObj- A C string object.
string- On entry, the value
NULL. On exit, a pointer to a copy of the character data associated with the specified C string object.DESCRIPTION
TheQ3CString_GetStringfunction returns, through thestringparameter, a pointer to a copy of the character data associated with the C string object specified by thestringObjparameter. The value of thestringparameter must beNULLwhen you callQ3CString_GetString, because it allocates memory and overwrites thestringparameter. For instance, the following sequence of calls will cause a memory leak:
myStatus = Q3CString_GetString(myStringObj, &myString); myStatus = Q3CString_GetString(myStringObj, &myString);After the second call toQ3CString_GetString, the memory allocated by the first call toQ3CString_GetStringis leaked; you cannot deallocate that memory because you've lost its address. You must make certain to callQ3CString_EmptyDatato release the memory allocated byQ3CString_GetStringwhen you are finished using the string data, and always before callingQ3CString_GetStringwith the same string pointer. Here is an example:
myStatus = Q3CString_GetString(myStringObj, &myString); myStatus = Q3CString_EmptyData(&myString); myStatus = Q3CString_GetString(myStringObj, &myString);If the value of thestringparameter is notNULL,Q3CString_GetStringgenerates a warning.You should use
Q3CString_GetStringonly with string objects of typekQ3StringTypeCString.ERRORS AND WARNINGS
kQ3WarningPossibleMemoryLeak