Difference between revisions of "Dbsize()"
From Recital Documentation Wiki
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 11: | Line 11: | ||
<input parameter> | <input parameter> | ||
− | char *dbf; | + | char *dbf; /* .DBF file descriptor */ |
<output parameter> | <output parameter> | ||
− | long size; | + | long size; /* Address of the variable where the number of records allocated in the .DBF file is returned by the function */ |
</code> | </code> | ||
Line 38: | Line 38: | ||
#include "dbl.h" | #include "dbl.h" | ||
− | char *dbf; /* .DBF file descriptor */ | + | char *dbf; /* .DBF file descriptor */ |
− | long db_size; /* Size of the .DBF file */ | + | long db_size; /* Size of the .DBF file */ |
− | int rc; /* Return code | + | int rc; /* Return code */ |
rc = dbsize(dbf, &db_size); | rc = dbsize(dbf, &db_size); | ||
− | if (rc = = SUCCESS) { | + | if (rc == SUCCESS) { |
printf("the number of records in the database: | printf("the number of records in the database: | ||
− | %1d n", db_size); | + | %1d \n", db_size); |
} else { | } else { | ||
− | printf("error number %d n", rc); | + | printf("error number %d \n", rc); |
exit (1); | exit (1); | ||
} | } |
Latest revision as of 15:31, 1 May 2009
PURPOSE
get number of records in a data file
SYNOPSIS
#include "dbl.h" int dbsize(dbf, size) <input parameter> char *dbf; /* .DBF file descriptor */ <output parameter> long size; /* Address of the variable where the number of records allocated in the .DBF file is returned by the function */
RETURN VALUE
The dbsize() function returns 0 for success, < 0 if an error occurs. See the section on return code values for a detailed list of return codes.
DESCRIPTION
This function returns the number of records currently allocated in the specified .DBF file.
EXAMPLE
This example obtains the number of records existing in the .DBF file whose file descriptor is in "char *dbf" and prints the number on the standard output.
#include "dbl.h" char *dbf; /* .DBF file descriptor */ long db_size; /* Size of the .DBF file */ int rc; /* Return code */ rc = dbsize(dbf, &db_size); if (rc == SUCCESS) { printf("the number of records in the database: %1d \n", db_size); } else { printf("error number %d \n", rc); exit (1); }