Fnext
, Fnext32
-get next field occurrence
#include <stdio.h>
#include "fml.h"
int
Fnext(FBFR *fbfr, FLDID *fieldid, FLDOCC *oc, char *value, FLDLEN *len)
#include "fml32.h"
int
Fnext32(FBFR32 *fbfr, FLDID32 *fieldid, FLDOCC32 *oc, char *value, FLDLEN32 *len)
Fnext
() finds the next field in the buffer after the specified field occurrence. fbfr is a pointer to a fielded buffer. fieldid is a pointer to a field identifier. oc is a pointer to the occurrence number of the field. value is a pointer to the value of the next field. len is the length of the next value.
The field identifier, FIRSTFLDID
, should be specified to get the first field in the buffer (for example, on the first call to Fnext
()). If value is not NULL, the next field value is copied into value; *len is used to determine if the buffer has enough space allocated to contain the value. The value's length is returned in *len. If len is NULL when the function is called, it is assumed that there is enough space and the new value length is not returned. If value is NULL, the value is not retrieved and only fieldid and oc are updated. The *fieldid and *oc parameters are respectively set to the next found field and occurrence. If no more fields are found, 0 is returned (end of buffer) and *fieldid, *oc, and *value are left unchanged. Fields are returned in field identifier order.
Although the type of value is char
*, the value returned will be of the same type as the next field being retrieved.
Fnext32
is used with 32-bit FML.
Fnext
() returns 1 when the next occurrence is successfully found. It returns 0 when the end of the buffer is reached.
This function returns \-1 on error and sets Ferror
to indicate the error condition.
Under the following conditions, Fnext
() fails and sets Ferror
to:
[FALIGNERR]
[FNOTFLD]
Finit
().
[FNOSPACE]
[FEINVAL]
Fintro
(3), Fget
(3), Fnum
(3)