Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / buffer.h / buffer_flush.3.md

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

# NAME

buffer_flush - flush a writing I/O buffer

# SYNOPSIS

    #include <limb/buffer.h>

```pre hl
int buffer_flush(buffer *<em>buf</em>)
```

# DESCRIPTION

The `buffer_flush`() function will flush data in the internal memory of the
buffer pointed by `buf`, to be written out into the file descriptor associated
with the buffer.

! WARN:
! Note that a successful call to `buffer_flush`() (i.e. with a return value
! of 1) does /not/ imply the buffer is now empty, as only /some/ of its data
! might have been written out.
! If needing to be sure, one should check with [buffer_isempty](3).

# RETURN VALUE

The `buffer_flush`() function returns 1 when at least some data have been
flushed/written out, else it returns 0 and sets `errno` to indicate the error.

# ERRORS

The `buffer_flush`() function may fail for any of the error specified for its
operational function, as set via e.g. [buffer_init](3).