Routines (alphabetical) > Routines: H > HDF Routines > HDF_OPEN

# HDF_OPEN

The HDF_OPEN function opens or creates an HDF file for reading and/or writing.

Note that any combination of the READ, WRITE and CREATE keywords is valid.

## Syntax

Result = HDF_OPEN( Filename [, /ALL] [, /CREATE] [, NUM_DD=value] [, /RDWR] [, /READ] [, /WRITE] )

## Return Value

If successful, a non-zero file handle (a longword integer) is returned. Longword -1 is returned on failure.

## Arguments

### Filename

A scalar string containing the name of the file to be opened.

## Keywords

### ALL

Set this keyword to create a new HDF file with read and write access. Setting this keyword is equivalent to:

HDF_OPEN(filename, /READ, /WRITE, /CREATE)

### CREATE

Set this keyword to create a new HDF file.

### NUM_DD

Use this keyword to override the machine default for the number of data descriptors to be allocated per DD block. For example:

H = HDF_OPEN('foo.hdf',/CREATE,/WRITE, NUM_DD=100)

### RDWR

Set this keyword to open file with both read and write access. Setting this keyword is equivalent to:

HDF_OPEN(filename, /READ, /WRITE)

### READ

Set this keyword to open the file with read access.

### WRITE

Set this keyword to open the file with write access.

## Version History

Pre 4.0 | Introduced