Dbgetm()

From Recital Documentation Wiki
Revision as of 10:45, 1 May 2009 by Yvonnemilne (Talk | contribs)

Jump to: navigation, search

PURPOSE

get memo from memo file


SYNOPSIS

#include "dbl.h"
 
	int	dbgetm(fd, field, memo, maxsize)
 
	<input parameters>
	int	fd;			/* .DBT file descriptor */
	char	*field;		/* Address of a 4 byte value that represents a memo field of a record in a .DBF file */
	int	maxsize;		/* Maximum bytes to read */
 
	<output parameter>
	char	*memo;		/* Address of a user supplied memo buffer */


RETURN VALUE

The dbgetm() function returns 0 for success. See the section on return code values for a detailed list of return codes.


DESCRIPTION

This function reads a memo from a .dbt file into the user buffer pointed to by the output parameter "memo". A user can define the maximum number of bytes that can be read/written to a memo file by the fourth parameter "maxsize". If maxsize is 0, then any size is read.


EXAMPLE

The following example first reads the 3rd record from the database file into the record buffer "char record[1000];", then reads a memo from the .dbt whose file descriptor is in "char *dbt" into the memo buffer "char memo[5000]. The corresponding record is assumed to contain its memo field starting at the 231st byte position.

#include "dbl.h"
 
	char	*dbf;			/* Address of .DBF file descriptor	*/
	char	*dbt;			/* Address of .DBT file descriptor	*/
	char	record[1000];	/* Record buffer			*/
	char	status;		/* Record status			*/
	char	memo[5000];	/* Buffer to hold the read memo	*/
	int	rc;			/* Return code			*/
 
	rc = dbgetr(dbf, 3, record, &status);
	if (rc = = SUCCESS){
		rc = dbgetm(dbt, &record[231], memo, 0);
		if (rc = = SUCCESS) printf("memo read\n");
		else {
			print("error message %d", rc);
			exit (1);
		}
	}


SEE ALSO

dbmopen(), dbputm()