Difference between revisions of "Dbrecout()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
Line 11: Line 11:
  
 
<input parameters>
 
<input parameters>
int *dbffd; /* Database file descriptor*/
+
int *dbffd; /* Database file descriptor */
dBFIELD *fields; /* Array of record fields*/
+
dBFIELD *fields; /* Array of record fields */
int *fldpos; /* Array of field offsets*/
+
int *fldpos; /* Array of field offsets */
char *buffer; /* Address of a buffer where record starts */
+
char *buffer; /* Address of a buffer where record starts */
char fldbuf[128][256]; /* Buffers to update from the record */
+
char fldbuf[128][256]; /* Buffers to update from the record */
  
  
Line 41: Line 41:
 
#include "dbl.h"
 
#include "dbl.h"
  
char *dbf; /* .DBF file descriptor */
+
char *dbf; /* .DBF file descriptor */
dBFIELD fields[128]; /* Return code */
+
dBFIELD fields[128]; /* Return code */
int fieldpos[128]; /* Field positions */
+
int fieldpos[128]; /* Field positions */
char record[1000]; /* Record buffer */
+
char record[1000]; /* Record buffer */
char fieldbuf[128][256]; /* Field buffers */
+
char fieldbuf[128][256]; /* Field buffers */
  
 
rc = dbrecout(dbf, fields, fieldpos, record, fieldbuf);
 
rc = dbrecout(dbf, fields, fieldpos, record, fieldbuf);
if (rc = = SUCCESS) printf("record filled n");
+
if (rc == SUCCESS) printf("record filled \n");
 
else {
 
else {
printf("error number %d n", rc);
+
printf("error number %d \n", rc);
 
exit (1);
 
exit (1);
 
}
 
}

Latest revision as of 14:26, 1 May 2009

PURPOSE

split the record buffer into individual field components


SYNOPSIS

#include "dbl.h"
 
	int	dbrecout(dbf, fields, fldpos, buffer, fldbuf)
 
	<input parameters>
	int		*dbffd;			/* Database file descriptor */
	dBFIELD	*fields;			/* Array of record fields */
	int		*fldpos;			/* Array of field offsets */
	char		*buffer;			/* Address of a buffer where record starts */
	char		fldbuf[128][256];	/* Buffers to update from the record */
 
 
	<output parameters>
	none


RETURN VALUE

The dbrecout() function returns 0 for success, or < 0 if an error occurs. See the section on return code values for a detailed list of return codes.


DESCRIPTION

The dbrecout() function splits a record buffer into its component fields by placing the individual fields into 'fldbuf'. The 'fields' and 'fldpos' are provided by The dbgetfx() function.


EXAMPLE

This example splits the record "dBFIELD fields" with ASCII information stored in "char fieldbuf[128][256]".

#include "dbl.h"
 
	char		*dbf;				/* .DBF file descriptor */
	dBFIELD	fields[128];		/* Return code */
	int		fieldpos[128];		/* Field positions */
	char		record[1000];		/* Record buffer */
	char		fieldbuf[128][256];	/* Field buffers */
 
	rc = dbrecout(dbf, fields, fieldpos, record, fieldbuf);
	if (rc == SUCCESS) printf("record filled \n");
	else {
		printf("error number %d \n", rc);
		exit (1);
	}


SEE ALSO

dbgather(), dbgetfx(), dbgetr(), dbrecin(), dbscatter()