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

# CDF_ATTCREATE

The CDF_ATTCREATE function creates a new attribute in the specified Common Data Format file. If successful, the attribute ID is returned.

## Examples

id = CDF_OPEN('test') ; Create a CDF file.

xx = CDF_ATTCREATE(id, 'Attribute-1', /GLOBAL_SCOPE)

CDF_ATTRENAME, id, 'Attribute-1', 'My Favorite Attribute'

PRINT, CDF_ATTNUM(id, 'My Favorite Attribute')

CDF_CLOSE, id ; Close the CDF file.

## Syntax

Result = CDF_ATTCREATE( Id, Attribute_Name [, /GLOBAL_SCOPE] [, /VARIABLE_SCOPE] )

## Return Value

Returns the attribute ID.

## Arguments

### Id

The CDF ID of the file for which a new attribute is created, returned from a previous call to CDF_OPEN or CDF_CREATE.

### Attribute_Name

A string containing the name of the attribute to be created.

## Keywords

### GLOBAL_SCOPE

Set this keyword to make the scope of the attribute global. This is the default.

### VARIABLE_SCOPE

Set this keyword to indicate that the attribute’s scope is per variable.

## Version History

Pre 4.0 | Introduced