version 2003
PA_GetTextInArray (array; index; text) long
Parameter | Type | Description | |
array | PA_Variable | Array to access | |
index | long | Index of the element to access | |
text | char * | Pointer to the text | |
Function result | long | Size of text in bytes |
Description
The routine PA_GetTextInArray fills the data pointed to by text with the text data of the index element of the text array array, and returns the size of the text.
First, pass zero in text to get the size of the text, then allocate a buffer with the correct size and again call the routine passing it this buffer. See the example below.
If the array is not a eVK_ArrayText or if index is out of range, the routine returns 0 and leaves text unchanged.
PA_GetTextInArray fills the data with Macintosh characters on Macintosh and ANSI characters under Windows, unless you have previously called the PA_UseMacCharacters or PA_UseAnsiCharacters function.
Example
Get the value of the current element (no error check in this sample).
char *buffer; long size; size = PA_GetTextInArray( arr, PA_GetArrayCurrent( arr ), 0L ); buffer = malloc( size ); size = PA_GetTextInArray( arr, PA_GetArrayCurrent( arr ), buffer ); /* . . . work with text buffer . . . */ free( buffer );
See Also
PA_SetTextInArray, PA_UseAnsiCharacters, PA_UseMacCharacters.
Error Handling
None.