Dbputm()

From Recital Documentation Wiki
Revision as of 10:10, 2 April 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PURPOSE

put memo in memo file


SYNOPSIS

#include "dbl.h"
 
	int	dbputm(dbt, memo, field)
 
	<input parameters>
	char	*dbt;		/* .DBT file descriptor		*/
	char	*memo;	/* Address of a buffer containing the memo to be put into the field	*/
 
	<output parameters>
	char	*field;		/* Address of the memo field		*/


RETURN VALUE

The dbputm() function returns 0 for success. See the section on return value codes for a detailed list of failure codes.


DESCRIPTION

This function writes a memo from a specified buffer to the specified .DBT file. The contents of the output parameter "field" indicate where the memo is put in the .DBT file. These contents should be identical to the contents of a memo field of a data record when it is written or updated in the .DBT file. This function does not automatically update the memo field of the corresponding .DBF file: the functions dbputr() or dbupdr() must be used for this purpose.


EXAMPLE

This example writes a memo from the buffer "char memo[512]" to the .DBT file whose file descriptor is in "char *dbt" and then writes a record, with the record number 200, whose contents are in "char record[1000]" to the .DBF file. The record is assumed to contain its memo field starting from the 235th byte.

#include "dbl.h"
 
	char	*dbt;			/* .DBT file descriptor	*/
	char	*dbf;			/* .DBF file descriptor	*/
	char	memo[512];		/* Memo buffer		*/
	char	record[1000];		/* Record buffer		*/
	int	rc;			/* Return code			*/
 
	rc = dbputm(dbt, memo, &record[234]);
	if (rc = = SUCCESS){
		rc = dbputr(dbf, 200, record);
		if (rc = = SUCCESS) printf("memo buffer written n");
		else {
			printf("error number %d n", rc);
			exit (1);
		}
	}


SEE ALSO

dbgetm(), dbmopen(), dbputr(), dbupdm()