opensc/doc/api/file/sc_write_binary.xml

57 lines
1.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<refentry id="scwritebinary">
<refentryinfo><title>OpenSC API Reference</title></refentryinfo>
<refmeta>
<refentrytitle>sc_write_binary</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>opensc</refmiscinfo>
</refmeta>
<refnamediv>
<refname>sc_write_binary</refname>
<refpurpose>Write to a new file</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<para>
<programlisting>
#include &lt;opensc.h&gt;
int sc_write_binary(struct sc_card *card, unsigned int offset,
const unsigned char *buf, size_t count,
unsigned long flags);
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Description</title>
<para>
This function writes <emphasis>count</emphasis> bytes from the buffer pointed to by
<emphasis>buf</emphasis> to a transparent elementary file (EF) on <emphasis>card</emphasis>. It
corresponds to the ISO 7816 WRITE BINARY function. Call <link
linkend="scselectfile">sc_select_file()</link> first to select the file to write to.
</para>
<para>
This function is used to write to a newly created file, or to a a previously unused portion of a
file. For updating an existing file, use the <link
linkend="scupdatebinary">sc_update_binary()</link> function.
</para>
<para>
The <emphasis>offset</emphasis> argument specifies the file offset in bytes. The
<emphasis>flags</emphasis> argument is currently not used, and should be set to 0.
</para>
</refsect1>
<refsect1>
<title>Return value</title>
<para>
If successful, the number of bytes written is returned. Otherwise, a negative value is
returned.
</para>
</refsect1>
</refentry>