![]() |
DDraceNetwork Documentation
|
Typedefs | |
| typedef struct ASYNCIO | ASYNCIO |
| typedef void * | IOHANDLE |
Enumerations | |
| enum | { IOFLAG_READ = 1 , IOFLAG_WRITE = 2 , IOFLAG_APPEND = 4 } |
| enum | ESeekOrigin { IOSEEK_START = 0 , IOSEEK_CUR = 1 , IOSEEK_END = 2 } |
Functions | |
| IOHANDLE | io_open (const char *filename, int flags) |
| unsigned | io_read (IOHANDLE io, void *buffer, unsigned size) |
| bool | io_read_all (IOHANDLE io, void **result, unsigned *result_len) |
| char * | io_read_all_str (IOHANDLE io) |
| int | io_skip (IOHANDLE io, int64_t size) |
| int | io_seek (IOHANDLE io, int64_t offset, ESeekOrigin origin) |
| int64_t | io_tell (IOHANDLE io) |
| int64_t | io_length (IOHANDLE io) |
| unsigned | io_write (IOHANDLE io, const void *buffer, unsigned size) |
| bool | io_write_newline (IOHANDLE io) |
| int | io_close (IOHANDLE io) |
| int | io_flush (IOHANDLE io) |
| int | io_sync (IOHANDLE io) |
| int | io_error (IOHANDLE io) |
| IOHANDLE | io_stdin () |
| IOHANDLE | io_stdout () |
| IOHANDLE | io_stderr () |
| IOHANDLE | io_current_exe () |
| ASYNCIO * | aio_new (IOHANDLE io) |
| void | aio_lock (ASYNCIO *aio) |
| void | aio_unlock (ASYNCIO *aio) |
| void | aio_write (ASYNCIO *aio, const void *buffer, unsigned size) |
| void | aio_write_newline (ASYNCIO *aio) |
| void | aio_write_unlocked (ASYNCIO *aio, const void *buffer, unsigned size) |
| void | aio_write_newline_unlocked (ASYNCIO *aio) |
| int | aio_error (ASYNCIO *aio) |
| void | aio_close (ASYNCIO *aio) |
| void | aio_wait (ASYNCIO *aio) |
| void | aio_free (ASYNCIO *aio) |
File I/O related operations.
| typedef struct ASYNCIO ASYNCIO |
Wrapper for asynchronously writing to an IOHANDLE.
| typedef void* IOHANDLE |
Handle for input/output files/streams.
| anonymous enum |
| enum ESeekOrigin |
| void aio_close | ( | ASYNCIO * | aio | ) |
Queues file closing.
| aio | Handle to the file. |
| int aio_error | ( | ASYNCIO * | aio | ) |
Checks whether errors have occurred during the asynchronous writing.
Call this function regularly to see if there are errors. Call this function after aio_wait to see if the process of writing to the file succeeded.
| aio | Handle to the file. |
| void aio_free | ( | ASYNCIO * | aio | ) |
Frees the resources associated with the asynchronous file handle.
| aio | Handle to the file. |
| void aio_lock | ( | ASYNCIO * | aio | ) |
Locks the ASYNCIO structure so it can't be written into by other threads.
| aio | Handle to the file. |
Wraps a IOHANDLE for asynchronous writing.
| io | Handle to the file. |
| void aio_unlock | ( | ASYNCIO * | aio | ) |
Unlocks the ASYNCIO structure after finishing the contiguous write.
| aio | Handle to the file. |
| void aio_wait | ( | ASYNCIO * | aio | ) |
Wait for the asynchronous operations to complete.
| aio | Handle to the file. |
| void aio_write | ( | ASYNCIO * | aio, |
| const void * | buffer, | ||
| unsigned | size ) |
Queues a chunk of data for writing.
| aio | Handle to the file. |
| buffer | Pointer to the data that should be written. |
| size | Number of bytes to write. |
| void aio_write_newline | ( | ASYNCIO * | aio | ) |
Queues a newline for writing.
| aio | Handle to the file. |
| void aio_write_newline_unlocked | ( | ASYNCIO * | aio | ) |
| void aio_write_unlocked | ( | ASYNCIO * | aio, |
| const void * | buffer, | ||
| unsigned | size ) |
| int io_close | ( | IOHANDLE | io | ) |
Closes a file.
| io | Handle to the file. |
| IOHANDLE io_current_exe | ( | ) |
Returns a handle for the current executable.
| int io_error | ( | IOHANDLE | io | ) |
Checks whether an error occurred during I/O with the file.
| io | Handle to the file. |
| int io_flush | ( | IOHANDLE | io | ) |
Empties all buffers and writes all pending data.
| io | Handle to the file. |
| int64_t io_length | ( | IOHANDLE | io | ) |
Gets the total length of the file. Resets cursor to the beginning.
| io | Handle to the file. |
| IOHANDLE io_open | ( | const char * | filename, |
| int | flags ) |
Opens a file.
| filename | File to open. |
| flags | A set of IOFLAG flags. |
| unsigned io_read | ( | IOHANDLE | io, |
| void * | buffer, | ||
| unsigned | size ) |
Reads data into a buffer from a file.
| io | Handle to the file to read data from. |
| buffer | Pointer to the buffer that will receive the data. |
| size | Number of bytes to read from the file. |
| bool io_read_all | ( | IOHANDLE | io, |
| void ** | result, | ||
| unsigned * | result_len ) |
Reads the rest of the file into a buffer.
| io | Handle to the file to read data from. |
| result | Receives the file's remaining contents. |
| result_len | Receives the file's remaining length. |
| char * io_read_all_str | ( | IOHANDLE | io | ) |
Reads the rest of the file into a null-terminated buffer with no internal null bytes.
| io | Handle to the file to read data from. |
| int io_seek | ( | IOHANDLE | io, |
| int64_t | offset, | ||
| ESeekOrigin | origin ) |
Seeks to a specified offset in the file.
| io | Handle to the file. |
| offset | Offset from position to search. |
| origin | Position to start searching from. |
| int io_skip | ( | IOHANDLE | io, |
| int64_t | size ) |
Skips data in a file.
| io | Handle to the file. |
| size | Number of bytes to skip. |
| IOHANDLE io_stderr | ( | ) |
Returns a handle for the standard error.
| IOHANDLE io_stdin | ( | ) |
Returns a handle for the standard input.
| IOHANDLE io_stdout | ( | ) |
Returns a handle for the standard output.
| int io_sync | ( | IOHANDLE | io | ) |
Synchronize file changes to disk.
| io | Handle to the file. |
| int64_t io_tell | ( | IOHANDLE | io | ) |
Gets the current position in the file.
| io | Handle to the file. |
| unsigned io_write | ( | IOHANDLE | io, |
| const void * | buffer, | ||
| unsigned | size ) |
Writes data from a buffer to a file.
| io | Handle to the file. |
| buffer | Pointer to the data that should be written. |
| size | Number of bytes to write. |
| bool io_write_newline | ( | IOHANDLE | io | ) |
Writes a platform dependent newline to a file.
| io | Handle to the file. |