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

# HDF_DFR8_LASTREF

The HDF_DFR8_LASTREF function returns the reference number of the most recently read or written 8-bit image in an HDF file.

## Examples

h = HDF_OPEN('myhdf.hdf') ; Open an hdf file.

; IDL prints "0", meaning that the call was successful,

; but no reference number was available:

PRINT, HDF_DFR8_LASTREF()

; Create a 2D array representing an 8-bit image:

a = BINDGEN(100,100)

; Write the image to the file:

HDF_DFR8_ADDIMAGE, 'myhdf.hdf', a

; IDL prints the reference number for the last 8-bit image

; operation (for example, "2"). Note the reference number

; is not simply a 1-based "image number"; it could easily be

; "2" or "3" for the first operation on the file:

PRINT, HDF_DFR8_LASTREF()

HDF_DFR8_ADDIMAGE, 'myhdf.hdf', a ; Add another image.

; IDL prints "2", because we’ve put two 8-bit images in the file:

PRINT, HDF_DFR8_NIMAGES('myhdf.hdf')

HDF_CLOSE, h ; Close the file.

## Syntax

Result = HDF_DFR8_LASTREF( )

## Return Value

Returns the reference number of the most recently read or written image.

## Arguments

None

## Keywords

None

## Version History

4.0 | Introduced

## See Also

HDF_DFR8_ADDIMAGE, HDF_DFR8_GETIMAGE, HDF_DFR8_GETINFO, HDF_DFR8_LASTREF, HDF_DFR8_NIMAGES, HDF_DFR8_READREF, HDF_DFR8_RESTART