Macro in stdx_io.h

X_IO_VERSION_MAJOR

#define X_IO_VERSION_MAJOR 2
Macro in stdx_io.h

X_IO_VERSION_MINOR

#define X_IO_VERSION_MINOR 3
Macro in stdx_io.h

X_IO_VERSION_PATCH

#define X_IO_VERSION_PATCH 0
Function in stdx_io.h

x_io_open

Open a file with mode ("r", "rb", "w", etc.).

X_IO_API XFile * x_io_open(
 const char *filename,
 const char *mode
);
Function in stdx_io.h

x_io_close

Close a file and free internal memory.

X_IO_API void x_io_close(XFile *file);
Function in stdx_io.h

x_io_read

Read up to `size` bytes into buffer. Returns bytes read.

X_IO_API size_t x_io_read(
 XFile *file,
 void *buffer,
 size_t size
);
Function in stdx_io.h

x_io_read_all

Read the entire file into a buffer. Returns buffer (null-terminated, but not for text safety). Caller must free.

X_IO_API char * x_io_read_all(
 XFile *file,
 size_t *out_size
);
Function in stdx_io.h

x_io_read_text

Convenience: open, read, close. Returns null-terminated text.

X_IO_API char * x_io_read_text(
 const char *filename,
 size_t *out_size
);
Function in stdx_io.h

x_io_write

Write `size` bytes to file. Returns number of bytes written.

X_IO_API size_t x_io_write(
 XFile *file,
 const void *data,
 size_t size
);
Function in stdx_io.h

x_io_write_text

Write null-terminated text to a file (overwrite).

X_IO_API bool x_io_write_text(
 const char *filename,
 const char *text
);
Function in stdx_io.h

x_io_append_text

Append null-terminated text to file.

X_IO_API bool x_io_append_text(
 const char *filename,
 const char *text
);
Function in stdx_io.h

x_io_seek

Seek within file.

X_IO_API bool x_io_seek(
 XFile *file,
 long offset,
 int32_t origin
);
Function in stdx_io.h

x_io_tell

Return current file position.

X_IO_API long x_io_tell(XFile *file);
Function in stdx_io.h

x_io_rewind

Rewind file to beginning.

X_IO_API bool x_io_rewind(XFile *file);
Function in stdx_io.h

x_io_flush

Flush file buffer.

X_IO_API bool x_io_flush(XFile *file);
Function in stdx_io.h

x_io_eof

Check end-of-file.

X_IO_API bool x_io_eof(XFile *file);
Function in stdx_io.h

x_io_error

Check for file error.

X_IO_API bool x_io_error(XFile *file);
Function in stdx_io.h

x_io_clearerr

Clear file error and EOF flags.

X_IO_API void x_io_clearerr(XFile *file);
Function in stdx_io.h

x_io_fileno

Return underlying file descriptor.

X_IO_API int32_t x_io_fileno(XFile *file);
Macro in stdx_io.h

X_IO_ALLOC

#define X_IO_ALLOC(sz) malloc(sz)
Macro in stdx_io.h

X_IO_FREE

#define X_IO_FREE(p) free(p)
Struct in stdx_io.h

XFile_t

struct XFile_t{
  FILE *fp;
};