opensc/doc/api/file/sc_update_record.xml

57 lines
1.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<refentry id="scupdaterecord">
<refentryinfo><title>OpenSC API Reference</title></refentryinfo>
<refmeta>
<refentrytitle>sc_update_record</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>opensc</refmiscinfo>
</refmeta>
<refnamediv>
<refname>sc_update_record</refname>
<refpurpose>Write a record to an existing file</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<para>
<programlisting>
#include &lt;opensc.h&gt;
int sc_update_record(struct sc_card *card, unsigned int record,
const unsigned char *buf, size_t buflen,
unsigned long flags);
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Description</title>
<para>
This function writes a record that is <emphasis>buflen</emphasis> bytes long from the buffer
pointed to by <emphasis>buf</emphasis> to a record-structured elementary file (EF) on
<emphasis>card</emphasis>. The function corresponds to the ISO
7816 UPDATE RECORD function. Call <link linkend="scselectfile">sc_select_file()</link>
first to select the file to write to.
</para>
<para>
<emphasis>record</emphasis> specifies the ID of the record to be written, 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>
This function can be used for overwriting existing records only; for appending to
files, see the <link linkend="scappendrecord">sc_append_record()</link> function.
</para>
</refsect1>
<refsect1>
<title>Return value</title>
<para>
Returns the number of bytes written if successful, or a negative value in case of error.
</para>
</refsect1>
</refentry>