Child pages
  • I/O Streams

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Forgot to pass any kind of FD handle to the file I/O functions

...

Proposed Backend Interface

typedef union _PDCLIB_fd_t {
uintptr_t u;
intptr_t i;
void *p;
} _PDCLIB_fd_t;
struct _PDCLIB_file_vtbl {
size_t (*write) (_PDCLIB_fd_t fd, const char    *restrict buf, size_t len, fpos_t* restrict pos);
size_t (*read) (_PDCLIB_fd_t fd, char *restrict buf, size_t len, fpos_t* restrict pos); 
size_t (*wwrite)(_PDCLIB_fd_t fd, const wchar_t *restrict buf, size_t len, fpos_t* restrict pos);
size_t (*wread) (_PDCLIB_fd_t fd, wchar_t *restrict buf, size_t len, fpos_t* restrict pos);

// Other I/O functions - seek/close/etc 
}

All the functions take the following parameters:

...