ES File

file: es_file.h

Description: ES File

Interface Functions

es_file_t *es_file_new(const char *filename)
[source]

Create new ES File object

void es_file_destroy(es_file_t **self_p)
[source]

Destroy ES File object.

Parameters:
  • self_p: – Reference to ES File object.

const char *es_file_path_get(es_file_t *self)
[source]

Retrieve the path of a file stored on the disk.

Parameters:
  • self: – Reference to ES File object.

Returns:

Path of the file

int es_file_exist(es_file_t *self)
[source]

Check if a file exists on the disk

Parameters:
  • self: – Reference to ES File object.

Returns:

0 if succesfull, -1 on error

int es_file_remove(es_file_t *self)
[source]

Remove a file from the disk

Parameters:
  • self: – Reference to ES File object.

Returns:

0 if succesfull, -1 on error

int es_file_size_get(es_file_t *self)
[source]

Retrieve the size of a file

Parameters:
  • self: – Reference to ES File object.

Returns:

0 if succesfull, -1 on error

int es_file_open(es_file_t *self, const char *mode)
[source]

Open a file

Parameters:
  • self: – Reference to ES File object.

  • mode: – Mode in which the file will be opened

Returns:

0 if succesfull, -1 on error

int es_file_set(es_file_t*, uint32_t position)
[source]

Check if a file exists on the disk

Parameters:
  • self: – Reference to ES File object.

  • position: – Position at which the file cursor will be set.

Returns:

0 if succesfull, -1 on error

ssize_t es_file_read(es_file_t *self, uint8_t *data, uint32_t blksize)
[source]

Check if a file exists on the disk

Parameters:
  • self: – Reference to ES File object.

  • data: – Buffer in which the data will be stored

  • blksize: – Size of the data block to read

Returns:

0 if succesfull, -1 on error

ssize_t es_file_write(es_file_t *self, uint8_t *data, uint32_t blksize)
[source]

Check if a file exists on the disk

Parameters:
  • self: – Reference to ES File object.

  • data: – Data to write.

  • blksize: – Size of the data block to write.

Returns:

0 if succesfull, -1 on error

int es_file_sync(es_file_t *self)
[source]

Sync contents of the file on the disk

Parameters:
  • self: – Reference to ES File object.

Returns:

0 if succesfull, -1 on error

void es_file_close(es_file_t *self)
[source]

Close a file

Parameters:
  • self: – Reference to ES File object.