|
![]() |
![]() |
version 2003
PA_GetTextField (tNum; fNum; text) → long
Parameter | Type | Description | |
tNum | short | → | Table number of the field to access |
fNum | short | → | Field number of the field to access |
text | char* | ← | Pointer to the text data |
Function result | long | ← | Length of the text |
Description
The routine
PA_GetTextField
fills the buffer pointed to by
text
with the value of the field (of type text) number
fNum
of the current record of the table number
tNum
, and returns the length of the text.
If the field is not a text field, the routine leaves
text
unchanged, returns 0 and an error code in
PA_GetLastError
.
First call the routine, passing 0 in text to get the size of the text. Then, allocate the buffer and call the routine again to fill it.
Depending on default settings or on previous calls to
PA_UseMacCharacters
or
PA_UseANSICharacters
,
text
will contain Macintosh or ANSI characters.
Examples
Get the text of field 4 of table 2.
char *text;
long len;
len = PA_GetTextField( 2, 4, 0 );
if ( PA_GetLastError() == eER_NoErr )
{
text = malloc( len );
if ( text )
{
len = PA_GetTextField( 2, 4, text );
/* . . . */
free( text );
}
}
See Also
PA_SetTextField , PA_UseAnsiCharacters , PA_UseMacCharacters .
Error Handling
Use
PA_GetLastError
to see if an error occurred (
eER_InvalidFileNumber
,
eER_InvalidFieldNumber
)