Gets the length of a field's contentsint sm_dlength (int field_number);int sm_e_dlength (char *field_name, int element);int sm_i_dlength (char *field_name, int occurrence);int sm_n_dlength (char *field_name);int sm_o_dlength (int field_number, int occurrence);
- The field with the data to evaluate.
- The element in
field_namewith the data to evaluate.
- The occurrence in the field with the data to evaluate.
sm_dlengthreturns the length of the data in the specified field or occurrence of a field. The length includes any data that is shifted offscreen and therefore out of view. The length excludes leading blanks in right-justified fields, and trailing blanks in left-justified fields.
/* Save the contents of the "rank" field in a buffer
* of the proper size. */
if ((save_rank = malloc (sm_n_dlength ("rank") + 1)) == 0)
report_error ("malloc error.");
sm_n_getfield (save_rank, "rank");