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

# HDF_VG_ATTACH

The HDF_VG_ATTACH function attaches (opens) a VGroup in an HDF file for reading or writing.

If VGroup_id is set to -1, a new VGroup is created. If neither the READ nor WRITE keywords are set, the VGroup is opened for reading.

## Examples

See HDF_SD_IDTOREF for an example using this function.

## Syntax

Result = HDF_VG_ATTACH( FileHandle, VGroup_id [, /READ] [, /WRITE] )

## Return Value

If successful, a handle for the specified group is returned. If it fails, 0 is returned.

## Arguments

### FileHandle

The HDF file handle returned from a previous call to HDF_OPEN.

### VGroup_id

The VGroup reference number, generally obtained by HDF_VG_GETID or HDF_VG_LONE.

## Keywords

### READ

Set this keyword to open the VGroup for reading.

### WRITE

Set this keyword to open the VGroup for writing.

## Version History

4.0 | Introduced

## See Also

HDF_VG_DETACH