Routines (alphabetical) > Routines: C > CDF Routines > CDF_ATTGET

# CDF_ATTGET

The CDF_ATTGET procedure reads an attribute entry from a CDF file.

## Examples

; Open the CDF file created in the CDF_ATTPUT example:

id = CDF_OPEN('foo')

CDF_ATTGET, id, 'Attribute2', 'Var2', x

PRINT, X, FORMAT='("[",9(X,F3.1,","),X,F3.1,"]")'

CDF_CLOSE, id ; Close the CDF file.

#### IDL Output

[ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]

This is the expected output, since this attribute was created with a call to FINDGEN.

## Syntax

CDF_ATTGET, Id, Attribute, EntryNum, Value [, CDF_TYPE= variable] [, /ZVARIABLE]

## Arguments

### Id

The CDF ID, returned from a previous call to CDF_OPEN or CDF_CREATE.

### Attribute

A string containing the name of the attribute or the attribute number to be written.

### EntryNum

The entry number. If the attribute is variable in scope, this is either the name or number of the variable the attribute is to be associated with. If the attribute is global in scope, this is the actual gEntry. It is the user’s responsibility to keep track of valid gEntry numbers. Normally, gEntry numbers will begin with 0 or 1 and will increase up to MAXGENTRY (as reported in the GET_ATTR_INFO structure returned by CDF_CONTROL), but this is not required.

### Value

A named variable in which the value of the attribute is returned.

## Keywords

### CDF_TYPE

Set this keyword equal to a named variable that will contain the CDF type of the attribute entry, returned as a scalar string. Possible returned values are: CDF_CHAR, CDF_UCHAR, CDF_INT1, CDF_BYTE, CDF_UINT1, CDF_UINT2, CDF_INT2, CDF_UINT4, CDF_INT4, CDF_REAL4, CDF_FLOAT, CDF_REAL8, CDF_DOUBLE, CDF_EPOCH, or CDF_EPOCH16. If the type cannot be determined, “UNKNOWN” is returned.

### ZVARIABLE

If EntryNum is a variable ID (as opposed to a variable name) and the variable is a zVariable, set this flag to indicate that the variable ID is a zVariable ID. The default is to assume that EntryNum is an rVariable ID.

Note: The attribute must have a scope of VARIABLE_SCOPE.

## Version History

Pre 4.0 | Introduced
6.3 | Add support for EPOCH_16 type