---
name: "sc_check_sw"
section: "3"
platform: "linux"
package: "libopensc2-dev"
version: "0.11.13-1.1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/sc_check_sw"
---

# sc\_check\_sw(3)

Check return status from a card transaction

## NAME

sc\_check\_sw - Check return status from a card transaction

## SYNOPSIS

```
#include <opensc.h>
int sc_check_sw(struct sc_card *card, int sw1, int sw2);
```

## DESCRIPTION

This function checks the return status as given in *sw1* and *sw2* against the card-specific errors of *card*. These are set by sc\_transmit\_apdu() in the *apdu.sw1* and *apdu.sw2* fields, respectively.

The function should be called after every APDU transmission, to convert the card´s status code to an OpenSC error code.

## RETURN VALUE

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