1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
<?xml version="1.0" encoding="UTF-8"?>
<refentry id="screadrecord">
<refentryinfo><title>OpenSC API Reference</title></refentryinfo>
<refmeta>
<refentrytitle>sc_read_record</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>opensc</refmiscinfo>
</refmeta>
<refnamediv>
<refname>sc_read_record</refname>
<refpurpose>Read a record from a file</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<para>
<programlisting>
#include <opensc.h>
int sc_read_record(struct sc_card *card, unsigned int record,
unsigned char *buf, size_t buflen,
unsigned long flags);
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Description</title>
<para>
This function reads a record-structured elementary file (EF) from <emphasis>card</emphasis>. The
function corresponds to the <link linkend="iso7816">ISO 7816</link> READ RECORD function. Call
<link linkend="scselectfile">sc_select_file()</link> first to select the file to read from.
</para>
<para>
<emphasis>record</emphasis> specifies the ID of the record to be read, or, if
<emphasis>flags</emphasis> is set to <symbol>SC_RECORD_BY_REC_NR</symbol>, the record number. If
<emphasis>record</emphasis> is set to zero, the current record will be read.
</para>
<para>
The read data is stored in <emphasis>buf</emphasis>, which is <emphasis>buflen</emphasis> bytes
long.
</para>
</refsect1>
<refsect1>
<title>Return value</title>
<para>
Returns the number of bytes read if successful, or a negative value in case of error.
</para>
</refsect1>
</refentry>
|