Difference between revisions of "Dbgather()"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 12: | Line 12: | ||
<input parameters> | <input parameters> | ||
− | int dbf; | + | int dbf; /* Database file descriptor */ |
− | char record[1000]; /* Record buffer to refill */ | + | char record[1000]; /* Record buffer to refill */ |
− | char fldbuf[128][256]; /* Existing field buffers */ | + | char fldbuf[128][256]; /* Existing field buffers */ |
<output parameters> | <output parameters> | ||
Line 34: | Line 34: | ||
==EXAMPLE== | ==EXAMPLE== | ||
− | The following example retrieves (gathers) the data stored in the individual field buffers (fldbuf[128][255) placed there with The dbscatter() function, and returns this information back to the record buffer (buffer[1000]). | + | The following example retrieves (gathers) the data stored in the individual field buffers (fldbuf[128][255]) placed there with The dbscatter() function, and returns this information back to the record buffer (buffer[1000]). |
<code lang="c"> | <code lang="c"> | ||
#include "dbl.h" | #include "dbl.h" | ||
− | int dbf; | + | int dbf; /* Database file descriptor */ |
− | char record[1000]; /* Record buffer to fill */ | + | char record[1000]; /* Record buffer to fill */ |
− | char fldbuf[128][255]; /* Field buffers | + | char fldbuf[128][255]; /* Field buffers */ |
rc = dbgather(dbf, record, fldbuf); | rc = dbgather(dbf, record, fldbuf); | ||
if (rc != 0) { | if (rc != 0) { | ||
− | printf("Error gathering record: % | + | printf("Error gathering record: %d\n", rc); |
exit(1); | exit(1); | ||
}else{ | }else{ |
Latest revision as of 11:25, 15 April 2009
PURPOSE
place individual field buffers back to the record buffer that was "scattered" using dbscatter()
SYNOPSIS
#include "dbl.h" int dbgather(dbf, record, fldbuf) <input parameters> int dbf; /* Database file descriptor */ char record[1000]; /* Record buffer to refill */ char fldbuf[128][256]; /* Existing field buffers */ <output parameters> none
RETURN VALUE
The dbgather() function returns 0 for success. Refer to the section on return codes for a detailed list of return code definitions.
DESCRIPTION
The dbgather() function "gathers" individual field values stored in a two dimensional character array (fldbuf[128][256]) back into the record buffer (record[1000]). The field buffers are filled with [[dbscatter() function. The dbgather() function is similar to The dbrecin() function with the exception that it requires fewer input parameters.
EXAMPLE
The following example retrieves (gathers) the data stored in the individual field buffers (fldbuf[128][255]) placed there with The dbscatter() function, and returns this information back to the record buffer (buffer[1000]).
#include "dbl.h" int dbf; /* Database file descriptor */ char record[1000]; /* Record buffer to fill */ char fldbuf[128][255]; /* Field buffers */ rc = dbgather(dbf, record, fldbuf); if (rc != 0) { printf("Error gathering record: %d\n", rc); exit(1); }else{ printf("Record gathered!\n"); }
SEE ALSO
dbfield(), dbgcache(), dbgetr(), dbgetrk(), dbrecin(), dbrecout(), dbscatter()