save
Summary
#include <dataman/dataman.h>
save(idx_name);
char *idx_name;
Description
This routine saves the current state of the named index.
The argument is a string containing the name of the index
whose state you wish to save. Only one state may be
saved per index at one time. Successive calls to save
without a call to restore will loose any previously saved
state.
Example
#include <dataman/dataman.h>
main(argc,argv)
{
int tot; /* total charges */
...
get(num_ix,num_key); /* get key */
forward(num_ix) else /* get to total record */
error(); /* problems */
tot = atoi(mfld[1]); /* save the total */
save(num_ix); /* save the state */
while (1) {
forward(num_ix) else
break;
when_mfmt(2)
tot += atoi(mfld[3]); /* add to total */
else
break; /* end of charges */
} /* end of loop */
restore(num_ix); /* return to total rec */
itoa(tot,mfld[1]); /* save in record */
m_dirty; /* set dirty bit */
...
}
«previous next»