Programming Guide |
Gets the integer value of a field
int sm_intval(int field_number);int sm_e_intval(char *field_name, int element);int sm_i_intval(char *field_name, int occurrence);int sm_n_intval(char *field_name);int sm_o_intval(int field_number, int occurrence);
field_name
,field_number
- The field whose value is sought.
element
- The element in
field_name
whose value is sought.occurrence
- The occurrence in the field whose value is sought.
C only
- · The integer value of the specified field.
sm_intval
returns the integer value of the data contained in the specified field, including its sign. All other punctuation characters are ignored. Ifsm_intval
cannot find the field, it returns with 0. Because a field can contain a value of 0, you should use another method to check whether the field exists.
/* Retrieve the integer value of the
* "sequence" field. */
int sequence;
sequence = sm_n_intval("sequence");