![]() |
![]()
| ![]() |
![]()
NAME_xt_ff_raw_open() - Open a fast file stream for a raw file LIBRARY#include <fcntl.h> #include <xtend/fast-file.h> -lxtend SYNOPSISxt_ff_t *_xt_ff_raw_open(const char *filename, int flags) ARGUMENTSfilename Absolute or relative path of the file to open flags Bit flags passed to open(3) DESCRIPTION_xt_ff_raw_open(3) initializes a xt_ff_t stream, much as fopen(3) does for a FILE stream. Unlike fopen(3), _xt_ff_raw_open(3) takes the same bit mask argument as open(2) to determine the open mode. See open(3) for details. An optimally sized buffer for the underlying filesystem is allocated, along with additional space for limited xt_ff_ungetc(3) operations. The xt_ff_t system is simpler than and much faster than traditional FILE on typical systems. It is intended for processing large files character-by-character, where low-level block I/O is not convenient, but FILE I/O causes a bottleneck. RETURN VALUESA pointer to a xt_ff_t object on success, NULL on failure EXAMPLESxt_ff_t *stream; char *filename; // Read only stream = _xt_ff_raw_open(filename, O_RDONLY); // Overwrite stream = _xt_ff_raw_open(filename, O_WRONLY|O_CREAT|O_TRUNC); // Append stream = _xt_ff_raw_open(filename, O_WRONLY|O_APPEND); SEE ALSOopen(3), xt_ff_getc(3), xt_ff_putc(3), xt_ff_ungetc(3), xt_ff_close(3)
|