# OpenSC API Reference

sc_get_data
3
opensc

# sc_get_data

Get a primitive data object from a card

## Synopsis

    #include <opensc.h>

    int sc_get_data(sc_card_t *card, unsigned int tag,
                    unsigned char *buf, size_t buflen);

## Description

This function is used to retrieve a primitive data object from card. It corresponds to the GET DATA command in the ISO 7816 standard. The data is stored in buf, which is buflen bytes long.

The tag parameter specifies the object to be retrieved. Refer to the standard for the correct values to use.

## Return value

Returns 0 if successful, or a negative value in case of error.