Programming Guide


Writes formatted data to a field

int sm_amt_format(int field_number, char *buffer);
int sm_e_amt_format(char *field_name, int element, char *buffer);
int sm_i_amt_format(char *field_name, int occurrence, char *buffer);
int sm_n_amt_format(char *field_name, char *buffer);
int sm_o_amt_format(int field_number, int occurrence, char *buffer);

field_name, field_number
The field to receive the formatted data.

The onscreen element in the field.

The occurrence in the field.

A pointer to the data to write.



sm_amt_format writes data to a field in the following steps:

  1. Panther checks whether the field's format properties are set for numeric display. If so, it formats the data in buffer accordingly.
  2. Panther calls sm_putfield to write the string to the specified field. If the field's data_formatting property is set to PV_NONE, sm_putfield writes the unedited string. If the resulting string is too long for the field, Panther truncates it.


#include <smdefs.h>

/* Write a list of real numbers, stored as character strings,
* to the screen. The first and last fields in the list are
* tagged with special names.
int fld, first, last;
extern char *values[]; /* defined elsewhere */

last = sm_n_fldno("last");
first = sm_n_fldno("first");
for (fld = first; fld <= last; ++fld)
sm_amt_format(fld, values[fld - first]);

See Also

sm_dtofield, sm_strip_amt_ptr