sc_read_binary(3)

NAME
sc_read_binary, sc_write_binary, sc_update_binary - read and write files on a smart card

SYNOPSIS
#include <opensc.h>

int sc_read_binary(sc_card_t *card,
                   unsigned int offset,
                   unsigned char *buffer,
                   size_t count,
                   unsigned long flags);
int sc_write_binary(sc_card_t *card,
                   unsigned int offset,
                   const unsigned char *buffer,
                   size_t count,
                   unsigned long flags);
int sc_update_binary(sc_card_t *card,
                   unsigned int offset,
                   const unsigned char *buffer,
                   size_t count,
                   unsigned long flags);

DESCRIPTION
These functions read and write transparent elementary files (EFs) on a smart card. The correspond to the ISO 7816 functions READ BINARY, WRITE BINARY and UPDATE BINARY, respectively. (The difference between write and update is that the former means writing to an uninitialized file, while the latter is intended to update a file region previously written to - some card have different access conditions for these operations).

The offset argument specifies the file offset in bytes. Note that some cards may not allow writing at arbitrary offsets. Some versions of the GPK require that read/write operations on transparent files are aligned on a 4-byte boundary.

The flags argument is currently not used, and should be set to 0.

RETURN VALUE
If an error occurred, a negative error code is returned, as described in sc_error(3). Otherwise, the function will return the number of bytes read or written.

SEE ALSO
sc_file(3), sc_path(3), sc_establish_context(3), sc_select_file(3), sc_read_record(3), sc_delete_file(3), sc_create_file(3), sc_file_free(3).

AUTHOR
This manual page was written by Olaf Kirch <okir@suse.de>