---
name: "sc_read_binary"
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_read_binary"
---

# sc\_read\_binary(3)

Read a file

## NAME

sc\_read\_binary - Read a file

## SYNOPSIS

```
#include <opensc.h>
int sc_read_binary(struct sc_card *card, unsigned int offset,
                   unsigned char *buf, size_t count,
                   unsigned long flags);
```

## DESCRIPTION

This function reads from a transparent elementary file (EF) on *card*. It corresponds to the ISO 7816 READ BINARY function. Call sc\_select\_file() first to select the file to read from.

The data read from the file is stored in *buf*, which is *count* bytes long.

The *offset* argument specifies the file offset in bytes. The *flags* argument is currently not used, and should be set to 0.

## RETURN VALUE

If successful, the number of bytes read is returned. Otherwise, a negative value is returned.
