MGmDbArray - ( macro ) Assigns an array to a database for easy access.
MGrDbArray - ( routine ) Assigns an array to a database for easy access.
mojave green software co's general utilities library libMG.so.0 ( -lMG )
#include <MGrDbArray.h> void MGmDbArray( MGsDb, /* {db area name} */ char*, /* {db file name string} */, char* ); /* {db open file mode} */
MGrDbArray - Assigns an array to a database for easy access.
Once the array is assigned, the data base may be accessed like so, {dbStructureName}.array[record][field][character]. Data may be read, read/written, or appended depending on how it is opened.
The data base must be formated like this, each field terminated with a NULL and each record terminated with a LF (line feed ascii code 10 dec or 0x0A hex) and the entire database should be terminated with an EOF marker (-1). Every record must contain an equal number of fields, even if they are empty. Field length is arbratory, only that it be terminated with a NULL.
MGsDb *db is the structure that represents the data base in question.
None, void routine type.
Upon successful return the following values will be set:
{dbName}.array: the array to be used for accessing the data base.
{dbname}.buffer: address of the buffer containing the data base after it was read into memory
{dbName}.eof: set to byte size of the data base.
{dbName}.fieldQty: set to quanity of fields per record.
{dbName}.recordQty: set to the number of records in the data base
MGrDbArray sources | ||
---|---|---|
Makefile | html | |
MGrDbArray.c | html | .c |
MGrDbArray.h | html | .h |
/* To initialize a db area */ MGsDb portI; MGmDbArray( portI, "/var/db/portI.db", "r" ); /* to access a db record in "portI" */ portI.array[record_idx][field_idx] /* set each field in record 0 to it's field name */
Mojave Green Software Co. Landers Ca Michael C. Shultz copyright(c) March 2004 all rights reserved