Opening a database file

The first step in accessing the database file is to open it. This is accomplished using the DBOpen() intrinsic.

local int fd
fd = DBOpen( "irvine.pix", "r" )
if ( fd = 0 ) then
  print "The file was not found!"
return
endif

DBOpen returns an integer file handle on success, or 0 if it fails to open the file. As with the other file access intrinsics, the file handle is used to access the file in all subsequent commands after it has been opened. The second parameter "r" in the call to DBOpen() indicates the file is to be opened with read-only access.

Specifying "r+" will open the file with read-write access. Note that not all file types support all of the possible capabilities. If an unsupported operation is attempted on a file, it will either be ignored, cause the function to return a special value indicating the error, or cause an EASI error to occur.

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.