The HDF Group

HDF Reference Manual


[HDF Interface][Top]


HDFclose/hdfclose

intn HDFclose(int32 file_id)

file_id
IN:
File identifier returned by Hopen

Purpose
Closes the access path to the file.
Return value
Returns SUCCEED (or 0) if successful and FAIL (or -1) otherwise.
Description
The file identifier file_id is validated before the file is closed. If the identifier is valid, the function closes the access path to the file.
 
If there are still access identifiers attached to the file, the error code DFE_OPENAID is returned and the file is not closed. This is a common occurrence when developing new interfaces. See Hendaccess for further discussion of this problem.

FORTRAN
integer function hdfclose(file_id)
 
integer file_id

[HDF Interface][Top]


HDFopen/hdfopen

int32 HDFopen(char *filename, intn access, int16 n_dds)

filename
IN:
Complete path and filename for the file to be opened
access
IN:
File access code
n_dds
IN:
Number of data descriptors in a block if a new file is to be created

Purpose
Provides an access path to an HDF file by reading all the data descriptor blocks into memory.
Return value
Returns the file identifier if successful and FAIL (or -1) otherwise.
Description
If given a new file name, HDFopen will create a new file using the specified access type and number of data descriptors. If given an existing file name, HDFopen will open the file using the specified access type and ignore the n_dds argument.
 
HDF provides several file access code definitions:
 
DFACC_READ - Open for read only. If file does not exist, an error condition results.
DFACC_CREATE - If file exists, delete it, then open a new file for read/write.
DFACC_WRITE - Open for read/write. If file does not exist, create it.
 
If a file is opened and an attempt is made to reopen the file using DFACC_CREATE, HDF will issue the error DFE_ALROPEN. If the file is opened with read only access and an attempt is made to reopen the file for write access using DFACC_RDWR, DFACC_WRITE, or DFACC_ALL, HDF will attempt to reopen the file with read and write permissions.
 
Upon successful exit, the named file is opened with the relevant permissions, the data descriptors are set up in memory, and the associated file_id is returned. For new files, the appropriate file headers are also set up.

FORTRAN
integer function hdfopen(filename, access, n_dds)
 
character*(*) filename
 
integer access, n_dds


HDF4.2r4 - February 2009
Copyright
The HDF Group
www.hdfgroup.org
The HDF Group