version 2003
PA_GetUserStringKind PA_StringKind
Parameter | Type | Description | ||||
This command does not require any parameters | ||||||
Function result | PA_StringKind | Kind of string being used |
Description
The routine PA_GetUserStringKind returns the kind of string (Pascal or ANSI C) being used. It returns a result of type PA_StringKind, defined in the "PublicTypes.c" header file as :
typedef enum { eSK_CString = 0, eSK_PString } PA_StringKind;
By default, the API's setting is ANSI C strings. For special purposes and for generic routines, the developer will need to know what kind of strings are used to change/restore it.
Examples
(1) Generic concatenation
void ConcatStrings (char *srce, char *toAppend) { if(PA_GetUserStringKind() == eSK_CString) MyConcatCStrings(srce, toAppend); if(PA_GetUserStringKind() == eSK_PString) MyConcatPStrings( (unsigned char *) srce, (unsigned char *)toAppend); }
(2) Generic strlen
short my_strlen (char *s) { if(PA_GetUserStringKind() == eSK_CString) return (short) strlen( s ); if(PA_GetUserStringKind() == eSK_PString) return (short) s[0]; }
See Also
PA_UseCStrings, PA_UsePStrings.
Error Handling
None.