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

# HDF_DF24_LASTREF

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

## Examples

; Open an HDF file.

h=HDF_OPEN('myhdf.hdf')

PRINT, HDF_DF24_LASTREF()

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

; but no reference number was available.

; Create a 3D array, representing a 24-bit image:

a = BINDGEN(3,100,100)

; Write the 24-bit image to the file:

HDF_DF24_ADDIMAGE, 'myhdf.hdf', a

PRINT, HDF_DF24_LASTREF()

; IDL prints a reference number for the last operation

; (for example, 2). Note the reference number is not

; simply a 1-based "image number"; the reference number

; could easily be "2" or "3", etc.

; Write another image to the file:

HDF_DF24_ADDIMAGE, 'myhdf.hdf', a

; Print the last reference number:

PRINT, HDF_DF24_LASTREF()

PRINT, HDF_DF24_NIMAGES('myhdf.hdf')

; IDL prints "2" because we’ve written two images to the file.

; Close the file

HDF_CLOSE, h

## Syntax

Result = HDF_DF24_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_DF24_ADDIMAGE, HDF_DF24_GETIMAGE, HDF_DF24_GETINFO, HDF_DF24_NIMAGES, HDF_DF24_READREF, HDF_DF24_RESTART, HDF_DFR8_LASTREF