Programming Guide


Puts a string into a field

int sm_putfield(int field_number, char *data);
int sm_e_putfield(char *field_name, int element, char *data);
int sm_i_putfield(char *field_name, int occurrence, char *data);
int sm_n_putfield(char *field_name, char *data);
int sm_o_putfield(int field_number, int occurrence, char *data);

field_name, field_number
The field to receive the contents of data.

The element in array field_name to receive the string.

The occurrence in the field to receive the string.

A pointer to the string to put in the specified field or occurrence.



sm_putfield moves the string in data into the specified field, if it differs from the existing value. If the string is too long, Panther truncates it without warning. If the string is shorter than the destination field, Panther blank fills it according to the field's justification. If data points to an empty string, the field is cleared. This refreshes date and time fields that take system values.

sm_putfield sets the field's mdt property to PV_YES to indicate that it is modified, and clears its valided property to PV_NO to indicate that the field requires validation on exit. If you use variants sm_n_putfield or sm_i_putfield and field_name is absent from the screen, the value of data is put in the corresponding LDB entry.


#include <smdefs.h>

sm_putfield(1, "This string has 29 characters");

See Also

sm_deselect, sm_dtofield, sm_getfield, sm_itofield, sm_ltofield