sc_read_record(3)

NAME
sc_read_record, sc_write_record, sc_update_record - read and write files on a smart card

SYNOPSIS
#include <opensc.h>

int sc_read_record(sc_card_t *card,
                   unsigned int rec_nr,
                   unsigned char *buffer,
                   size_t count,
                   unsigned long flags);
int sc_write_record(sc_card_t *card,
                   unsigned int rec_nr,
                   const unsigned char *buffer,
                   size_t count,
                   unsigned long flags);
int sc_update_record(sc_card_t *card,
                   unsigned int rec_nr,
                   const unsigned char *buffer,
                   size_t count,
                   unsigned long flags);
int sc_append_record(sc_card_t *card,
                   const unsigned char *buffer,
                   size_t count,
                   unsigned long flags);

DESCRIPTION
This functions read and write record-structured elementary files (EFs) on a smart card. The correspond to the ISO 7816 functions READ RECORD, WRITE RECORD, APPEND RECORD and UPDATE RECORD, 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 record previously written to - some card have different access conditions for these operations).

The rec_nr argument specifies the number of the record to be written to, starting at 0.

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_binary(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>