xt_ff_dopen(3)

NAME
xt_ff_dopen() - Create a fast file stream from a file descriptor

LIBRARY
#include <fcntl.h>
#include <xtend/fast-file.h>
-lxtend

SYNOPSIS
xt_ff_t *xt_ff_dopen(int fd, int flags)

ARGUMENTS
fd          Open file descriptor to which stream is attached
flags       Bit flags passed to open(3)

DESCRIPTION
xt_ff_dopen(3) initializes a xt_ff_t stream, much as fdopen(3) does for a FILE stream. Unlike fdopen(3), xt_ff_dopen(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 VALUES
A pointer to a xt_ff_t object on success, NULL on failure

EXAMPLES
xt_ff_t *stream;
char    *filename;
int     fd;
fd = open(filename, O_RDONLY);
stream = xt_ff_dopen(fd, O_RDONLY);

SEE ALSO
xt_ff_open(3), open(3)