restore



Summary

#include <dataman/dataman.h>

restore(idx_name);

char *idx_name;

Description

This function restores the state of a saved index. The idx_name is the name of an index that has previously been saved. Remember that this is not the same as the get_current function. The database record retrieved will be the one pointed to at the time of the save command (which, because of the forward and back functions, is not necessarily the same as the key points to). If the database record has been deleted, or the key removed, this is an attempt to restore to an invalid state, and the program issues a diagnostic and terminates.

Example

    #include <dataman/dataman.h>

    main(int argc, char *argv[])
    {
        key k_buff;
          ...
        move(k_buff,num_key,strlen(num_key));
        get(num_ix,k_buff) else {
            pause(10,10,"Key not on file");
            return;
        }
        forward(num_ix) else     /* get to next rec */
            return;
        save(num_ix);            /* save index state */
        while(MFMT == 2) {
            forward(num_ix) else /* get to next rec */
                break;
              ...                /* process rec */
        }
        restore(num_ix);        /* restore to saved */
          ...                   /* continue processing */
    }

«previous  next»