Difference between revisions of "Dblockf()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
Line 11: Line 11:
  
 
<input parameter>
 
<input parameter>
char *dbf; /* File descriptor of a .DBF file to be locked */
+
char *dbf; /* File descriptor of a .DBF file to be locked */
  
 
<output parameter>
 
<output parameter>
Line 36: Line 36:
 
<code lang="c">
 
<code lang="c">
 
#include "dbl.h"
 
#include "dbl.h"
char *dbf; /* Database file descriptor */
+
char *dbf; /* Database file descriptor */
int rc; /* Return code */
+
int rc; /* Return code */
  
 
rc = dblockf(dbf);
 
rc = dblockf(dbf);
if (rc = SUCCESS) printf("file is locked n");
+
if (rc == SUCCESS) printf("file is locked \n");
 
else {
 
else {
printf("file could not be locked n");
+
printf("file could not be locked \n");
 
return (ERROR);
 
return (ERROR);
 
}
 
}

Latest revision as of 13:39, 1 May 2009

PURPOSE

lock a database file


SYNOPSIS

#include "dbl.h"
 
	int	dblock(dbf)
 
	<input parameter>
	char	*dbf;		/* File descriptor of a .DBF file to be locked */
 
	<output parameter>
	none


RETURN VALUE

The dblockf() function returns 0 for success, or < 0 if an error occurs. See the section on return values for a detailed list of return codes.


DESCRIPTION

The dblockf() function locks the database file from the given file descriptor "char *dbf".


EXAMPLE

The following example locks the .DBF file whose file descriptor is in "char *dbf".


#include "dbl.h"
	char	*dbf;		/* Database file descriptor */
	int	rc;		/* Return code */
 
	rc = dblockf(dbf);
	if (rc == SUCCESS) printf("file is locked \n");
	else {
		printf("file could not be locked \n");
		return (ERROR);
	}


SEE ALSO

dbfilemode(), dblocki(), dblockr(), dbtlockf(), dbtlockr(), dbunlockf(), dbunlocki(), dbunlockr()