---
name: "sc_select_file"
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_select_file"
---

# sc\_select\_file(3)

Select a file on a smart card

## NAME

sc\_select\_file - Select a file on a smart card

## SYNOPSIS

```
#include <opensc.h>
int sc_select_file(sc_card_t *card,
                   const sc_path_t *path,
                   sc_file_t **result);
```

## DESCRIPTION

This function selects the file specified by *path*. If *path* specifies a file within the currently selected DF, sc\_select\_file() will *not* select the MF first, but interpret the path relative to the current DF. It does this in order to prevent losing any authorizations previously established with the card (e.g. by presenting a PIN).

If *result* is not NULL, an sc\_file\_t object is created, and the pointer to this object is stored in the location pointed to by *result*. This handle should later be released using sc\_file\_free().

## RETURN VALUE

If an error occurred, a negative error code is returned. Otherwise, the function will return 0.
