version 2003
PA_SetStringField (tNum; fNum; string)
| Parameter | Type | Description | |
| tNum | short | Table number of the field to access | |
| fNum | short | Field number of the field to access | |
| string | char* | New string for the field |
Description
The routine PA_SetStringField fills the string field number fNum of the current record of the table number tNum with string.
If the field is not a string field, the routine does nothing and sets an error in PA_GetLastError().
By default, string needs to be a null terminated C string. If you have previously called PA_UsePStrings, you need to pass a Pascal string to the command.
By default, string needs to use the Macintosh characters set on Macintosh, and the ANSI characters set under Windows. You can call PA_UseMacCharacters or PA_UseAnsiCharacters to specifically use Macintosh or ANSI characters.
Example
Initialize a selection of record to a default string
(No error, locking problem checking in this sample)
void SetSelectionString( short tNum, short fNum, char *newValue )
{
PA_FirstRecord(tNum);
while ( ! PA_EndSelection( tNum ) )
{
PA_Yield();
PA_SetStringField( tNum, fNum, newValue );
PA_SaveRecord( tNum );
PA_NextRecord( tNum );
}
}
See Also
PA_GetStringField, PA_UseAnsiCharacters, PA_UseCStrings, PA_UseMacCharacters, PA_UsePStrings.
Error Handling
Use PA_GetLastError to see if an error occurred (eER_InvalidFileNumber, eER_InvalidFieldNumber).