Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / djbunix.h / read_close.3.md

% limb manual
% read_close(3)
% limb 0.1.0
% 2023-07-24

# NAME

read_close - read a file into memory and close it

# SYNOPSIS

    #include <limb/djbunix.h>

```pre hl
ssize_t read_close(char *<em>dst</em>, size_t <em>dlen</em>, int <em>fd</em>)
```

# DESCRIPTION

The `read_close`() function reads the entire content of the file associated with
file descriptor `fd` and places it into the memory pointed by `dst`, up to a
maximum of `dlen` bytes.

# RETURN VALUE

On success, the `read_close`() function returns the number of bytes read and
copied into memory. Otherwise, it returns -1 and sets `errno` to indicate the
error.

# ERRORS

The `read_close`() function may fail and set `errno` for any of the errors
described for [allread](3).