Gets the integer value of a fieldint 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);
- The field whose value is sought.
- The element in
field_namewhose value is sought.
- The occurrence in the field whose value is sought.
sm_intvalreturns the integer value of the data contained in the specified field, including its sign. All other punctuation characters are ignored. If
sm_intvalcannot 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. */
sequence = sm_n_intval("sequence");