# OpenSC API Reference

sc_detect_card_presence
3
opensc

# sc_detect_card_presence

Detect presence of smart card in a reader

## Synopsis

    #include <opensc.h>

    int sc_detect_card_presence(sc_reader_t *reader, int slot_id);

## Description

This function checks whether reader has a card present in slot_id.

## Return value

If an error occurred, the return value is a a negative OpenSC error code. If no card is present, 0 is returned. Otherwise, a positive value is returned, which is a combination of flags. The flag SC_SLOT_CARD_PRESENT is always set. In addition, if the card was exchanged, the SC_SLOT_CARD_CHANGED flag is set.