CFchg, CFchg32
-convert and change field
#include <stdio.h>
#include "fml.h"
int CFchg(FBFR *fbfr, FLDID fieldid, FLDOCC oc, char *value,
FLDLEN len, int type)
#include "fml32.h"
int CFchg32(FBFR32 *fbfr, FLDID32 fieldid, FLDOCC32 oc,
char *value,
FLDLEN32 len, int type)
CFchg()
acts like Fchg()
but first converts the value from the user-specified type to the type of the fieldid for which the field is changed in the fielded buffer. fbfr is a pointer to a fielded buffer. fieldid is a field identifier. oc is the occurrence number of the field. value is a pointer to a new value. len is the length of the value to be changed; it is required only if type is FLD_CARRAY
. type is the data type of value.
If a field occurrence is specified that does not exist, then NULL
values are added for the missing occurrences until the desired value can be added (e.g., changing field occurrence 4 for a field that does not exist in a buffer will cause 3 NULL
values to be added followed by the specified field value).
CFchg32
is used with 32-bit FML.
This function returns -1
on error and sets Ferror
to indicate the error condition.
Under the following conditions, CFchg
() fails and sets Ferror
to:
[FALIGNERR]
[FNOTFLD]
[FMALLOC]
[FEINVAL]
[FNOSPACE]
[FNOTPRES]
[FBADFLD]
[FTYPERR]
Fintro(3)
CFadd(3)
Fchg(3)