Ffindlast, Ffindlast32
-find last occurrence of field in buffer
#include <stdio.h>
#include "fml.h"
char *
Ffindlast(FBFR *fbfr, FLDID fieldid, FLDOCC *oc, FLDLEN *len) #include "fml32.h"
char *
Ffindlast32(FBFR32 *fbfr, FLDID32 fieldid, FLDOCC32 *oc, FLDLEN32 *len)
Ffindlast
() finds the last occurrence of a field in a buffer. fbfr is a pointer to a fielded buffer. fieldid is a field identifier. oc is a pointer to an integer that is used to receive the occurrence number of the field. len is the length of the value. If there are no occurrences of the field in the buffer, NULL is returned. Generally, Ffindlast
() acts like Ffind(3). The major difference is that with Ffindlast
the user does not supply a field occurrence. Instead, both the value and occurrence number of the last occurrence of the field are returned. In order to return the occurrence number of the last field, the occurrence argument, oc, to Ffindlast
() is a pointer-to-integer, and not an integer, as it is to Ffind()
. If oc is specified to be NULL, the occurrence number of the last occurrence is not returned. If the value of len is NULL, then the field length is not returned.
In general, the locations of values of types FLD_LONG
, FLD_FLOAT
, and FLD_DOUBLE
are not suitable for direct use as their stored type, since proper alignment within the buffer is not guaranteed. Such values must be copied first to a suitably aligned memory location. Accessing such fields through the conversion function CFfind(3) does guarantee the proper alignment of the found converted value. Buffer modification should only be done by the functions Fadd(3) or Fchg(3). The values returned by Ffind
() and Ffindlast
() are valid only so long as the buffer remains unmodified.
Ffindlast32
is used with 32-bit FML.
In the SYNOPSIS section above the return value to Ffindlast() is described as a character pointer data type (char * in C). Actually, the pointer returned points to an object that has the same type as the stored type of the field.
This function returns NULL on error and sets Ferror to indicate the error condition.
Under the following conditions, Ffindlast
() fails and sets Ferror to:
[FALIGNERR]
[FNOTFLD]
[FNOTPRES]
[FBADFLD]
Fintro
(3fml), CFfind
(3fml), Fadd
(3fml), Fchg
(3fml), Ffind
(3fml), Ffindocc
(3fml), Ffinds
(3fml)