Difference between revisions of "Dbscatter()"
From Recital Documentation Wiki
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
(2 intermediate revisions by one user not shown) | |||
Line 12: | Line 12: | ||
<input parameters> | <input parameters> | ||
− | char *dbf; | + | char *dbf; /* Database file descriptor */ |
− | char record[1000]; /* Record buffer | + | char record[1000]; /* Record buffer */ |
− | char fldbuf[128][256]; /* Field buffers to fill | + | char fldbuf[128][256]; /* Field buffers to fill */ |
<output parameters> | <output parameters> | ||
Line 31: | Line 31: | ||
==DESCRIPTION== | ==DESCRIPTION== | ||
− | The dbscatter() function "scatters" the specified record, retrieved with [[dbgetr()]]/[[dbgetrk()]], into individual field buffers. The command is similar to | + | The dbscatter() function "scatters" the specified record, retrieved with [[dbgetr()]] / [[dbgetrk()]], into individual field buffers. The command is similar to the dbrecout() function with the exception that it requires fewer input parameters. |
+ | |||
==EXAMPLE== | ==EXAMPLE== | ||
Line 40: | Line 41: | ||
#include "dbl.h" | #include "dbl.h" | ||
− | char *dbf; | + | char *dbf; /* Database file descriptor */ |
− | char record[1000]; /* Record buffer | + | char record[1000]; /* Record buffer */ |
− | char fldbuf[128][256]; /* Field buffers to fill | + | char fldbuf[128][256]; /* Field buffers to fill */ |
rc = dbscatter(dbf, record, fldbuf); | rc = dbscatter(dbf, record, fldbuf); | ||
if ( rc != 0 ) { | if ( rc != 0 ) { | ||
− | printf("Error scattering record; % | + | printf("Error scattering record; %d\n", rc); |
exit(1); | exit(1); | ||
} else { | } else { | ||
− | printf("Record scattered!n"); | + | printf("Record scattered!\n"); |
} | } | ||
− | |||
</code> | </code> | ||
Latest revision as of 15:01, 1 May 2009
PURPOSE
split the record buffer into individual field buffers
SYNOPSIS
#include "dbl.h" int dbscatter(dbf, record, fldbuf) <input parameters> char *dbf; /* Database file descriptor */ char record[1000]; /* Record buffer */ char fldbuf[128][256]; /* Field buffers to fill */ <output parameters> none
RETURN VALUE
The dbscatter() function returns 0 for success. Refer to the section on return codes for a detailed list of return code definitions.
DESCRIPTION
The dbscatter() function "scatters" the specified record, retrieved with dbgetr() / dbgetrk(), into individual field buffers. The command is similar to the dbrecout() function with the exception that it requires fewer input parameters.
EXAMPLE
The following example "scatters" the record stored in 'char record[1000]' into the specified field buffers (fldbuf[128][256]).
#include "dbl.h" char *dbf; /* Database file descriptor */ char record[1000]; /* Record buffer */ char fldbuf[128][256]; /* Field buffers to fill */ rc = dbscatter(dbf, record, fldbuf); if ( rc != 0 ) { printf("Error scattering record; %d\n", rc); exit(1); } else { printf("Record scattered!\n"); }