sort



Summary

#include <dataman/sort.h>

sort(key);

char *key;

Description

This routine places keys in an index. The argument key is a string containing the key to be inserted. This is only to be used in end sort programs (programs that generate new indexes). The current work record is associated with the key named, and the key inserted into the index being built. Keys that are shorter than the index defined maximum are padded with null characters.

Example

    #include <dataman/sort.h>

    main(int argc, char *argv[])
    {
        char *key;
          ...
        while(1) {
            if(!strcmp(FILE,"sig_file")) { /* do sig file */
                key = malloc(9);           /* space for key */
                *key = '#';                /* special char */
                strcpy(key+1,mfld[3]);     /* tack on key */
                sort(key);                 /* insert new key */
                free(key);
            }
            release else                   /* get next record */
                break;
              ...                          /* continue */
        }
    }

«previous  next»