limb 0.2.0

2024-01-09

sa_read(3)
limb manual
sa_read(3)

NAME

sa_read, sa_readmax - read a file and append its content to a stralloc

SYNOPSIS

#include <limb/djbunix.h>
int sa_read(stralloc *sa, int fd)
int sa_readmax(stralloc *sa, int fd, size_t max)

DESCRIPTION

The sa_read() function reads the entire content of the file associated with file descriptor fd and appends it into the stralloc pointed by sa.

The sa_readmax() function is similar to sa_read() but it will only read up to max bytes.

RETURN VALUE

On success, the sa_read() and sa_readmax() functions return 1. Otherwise they return 0 and set errno to indicate the error.

ERRORS

The sa_read() and sa_readmax() functions may fail and set errno for any of the errors described for fd_read(3) and stralloc_readyplus(3).

The sa_readmax() function may also fail if :

ENOBUFS

The file is larger than max bytes.

limb 0.1.0
2023-07-24
sa_read(3)