opensc/doc/api/file/sc_select_file.xml

56 lines
1.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<refentry id="scselectfile">
<refentryinfo><title>OpenSC API Reference</title></refentryinfo>
<refmeta>
<refentrytitle>sc_select_file</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>opensc</refmiscinfo>
</refmeta>
<refnamediv>
<refname>sc_select_file</refname>
<refpurpose>Select a file on a smart card</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<para>
<programlisting>
#include &lt;opensc.h&gt;
int sc_select_file(<link linkend="sccardt">sc_card_t</link> *card,
const <link linkend="scpatht">sc_path_t</link> *path,
<link linkend="scfilet">sc_file_t</link> **result);
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Description</title>
<para>
This function selects the file specified by <emphasis>path</emphasis>. If
<emphasis>path</emphasis> specifies a file within the currently selected DF, sc_select_file() will
<emphasis>not</emphasis> 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).
</para>
<para>
If <emphasis>result</emphasis> is not NULL, an <link linkend="scfilet">sc_file_t</link> object is
created, and the pointer to this object is stored in the location pointed to by
<emphasis>result</emphasis>. This handle should later be released using <link
linkend="scfilefree">sc_file_free()</link>.
</para>
</refsect1>
<refsect1>
<title>Return value</title>
<para>
If an error occurred, a negative error code is returned. Otherwise, the function will return 0.
</para>
</refsect1>
</refentry>