Difference between revisions of "Dbfwd()"
From Recital Documentation Wiki
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
(2 intermediate revisions by one user not shown) | |||
Line 36: | Line 36: | ||
<code lang="c"> | <code lang="c"> | ||
#include "dbl.h" | #include "dbl.h" | ||
− | int fd; /* .NDX file descriptor | + | int fd; /* .NDX file descriptor */ |
− | char key[100]; /* Buffer for previous key | + | char key[100]; /* Buffer for previous key */ |
− | long recnum; /* Record number of previous key */ | + | long recnum; /* Record number of previous key */ |
rc = dbfwd(fd); | rc = dbfwd(fd); | ||
− | if (rc = = SUCCESS){ | + | if (rc == SUCCESS){ |
rc = dbpkey(fd, key, &recnum); | rc = dbpkey(fd, key, &recnum); | ||
− | if (rc = = SUCCESS) printf("Last key read n"): | + | if (rc == SUCCESS) printf("Last key read \n"): |
else { | else { | ||
− | printf("error number %d n", rc); | + | printf("error number %d \n", rc); |
exit (1); | exit (1); | ||
} | } | ||
} else { | } else { | ||
− | printf("error number %d n", rc); | + | printf("error number %d \n", rc); |
exit (1); | exit (1); | ||
} | } |
Latest revision as of 12:55, 1 May 2009
PURPOSE
position access pointer at the end of .NDX file
SYNOPSIS
#include "dbl.h" int dbfwd(ndx) <input parameter> char *ndx; /* .NDX file descriptor */ <output parameters> none
RETURN VALUE
The dbfwd() 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
This function positions the access pointer at the end of the specified .NDX file.
EXAMPLE
This example positions the access pointer at the end of the .NDX file whose file descriptor is in "int fd" and reads the last key from the file.
#include "dbl.h" int fd; /* .NDX file descriptor */ char key[100]; /* Buffer for previous key */ long recnum; /* Record number of previous key */ rc = dbfwd(fd); if (rc == SUCCESS){ rc = dbpkey(fd, key, &recnum); if (rc == SUCCESS) printf("Last key read \n"): else { printf("error number %d \n", rc); exit (1); } } else { printf("error number %d \n", rc); exit (1); }