Difference between revisions of "Dbputm()"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 11: | Line 11: | ||
<input parameters> | <input parameters> | ||
− | char *dbt; /* .DBT file descriptor | + | char *dbt; /* .DBT file descriptor */ |
− | char *memo; /* Address of a buffer containing the memo to be put into the field */ | + | char *memo; /* Address of a buffer containing the memo to be put into the field */ |
<output parameters> | <output parameters> | ||
− | char *field; | + | char *field; /* Address of the memo field */ |
</code> | </code> | ||
Line 37: | Line 37: | ||
#include "dbl.h" | #include "dbl.h" | ||
− | char *dbt; | + | char *dbt; /* .DBT file descriptor */ |
− | char *dbf; | + | char *dbf; /* .DBF file descriptor */ |
− | char memo[512]; /* Memo buffer | + | char memo[512]; /* Memo buffer */ |
− | char record[1000]; /* Record buffer | + | char record[1000]; /* Record buffer */ |
− | int rc; | + | int rc; /* Return code */ |
rc = dbputm(dbt, memo, &record[234]); | rc = dbputm(dbt, memo, &record[234]); | ||
− | if (rc = = SUCCESS){ | + | if (rc == SUCCESS){ |
rc = dbputr(dbf, 200, record); | rc = dbputr(dbf, 200, record); | ||
− | if (rc = = SUCCESS) printf("memo buffer written n"); | + | if (rc == SUCCESS) printf("memo buffer written \n"); |
else { | else { | ||
− | printf("error number %d n", rc); | + | printf("error number %d \n", rc); |
exit (1); | exit (1); | ||
} | } |
Latest revision as of 14:08, 1 May 2009
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); } }