[Back to Interface] [Prev] [Next]

Hopen/hopen

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

filename IN:

Complete path and filename for the file to be opened

access IN:

Access code definition (preceded by DFACC_)

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, Hopen will create a new file using the specified access type and number of data descriptors. If given an existing file name, Hopen will open the file using the specified access type and ignore the n_dds argument.

The number of data descriptors in a block, n_dds, is a non-negative integer with a default value of DEF_NDDS (or 16) and a minimum value of MIN_NDDS (or 4). If the specified value of n_dds is less than MIN_NDDS, then it will be set to MIN_NDDS.

HDF provides several access code definitions:

DFACC_CREATE - If file exists, delete it, then open a new file for read/write.

DFACC_READ - Open for read only. If file does not exist, error.

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 code 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 or DFACC_WRITE, HDF will attempt to reopen the file with read and write permissions.

Upon successful exit, the specified 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 hopen(filename, access, n_dds)

character*(*) filename

integer access, n_dds



[Back to Interface] [Prev] [Next]

hdfhelp@ncsa.uiuc.edu
HDF Reference Manual - 07/29/98, NCSA HDF Development Group.