---
name: "buffer_flush"
section: "3"
platform: "linux"
package: "libowfat-dev"
version: "0.32-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/buffer_flush"
---

# buffer\_flush(3)

feed buffer to write function

## NAME

buffer\_flush - feed buffer to write function

## SYNTAX

**#include \<libowfat/buffer.h\>**

int **buffer\_flush**(buffer\* *b*);

## DESCRIPTION

buffer\_flush feeds a string *d*\[0\], *d*\[1\], ..., *d*\[*dlen*-1\] to the write operation by calling

  **op**(*fd*,*d*,*dlen*)

If **op** successfully handles one or more bytes at the beginning of the string, it must return the number of bytes handled; if this number is smaller than *dlen*, buffer\_flush will call **op** again with the rest of the string. If **op** does not handle any bytes, and does not encounter an error, it must return 0, or return -1 with *errno* set to EINTR; in either case, buffer\_flush will immediately call **op** again. If **op** encounters an error, it must return -1 with errno set to something other than EINTR; buffer\_flush will pass the error to the caller.

On success, buffer\_flush returns 0. On error, buffer\_flush returns -1, setting *errno* appropriately.

## SEE ALSO

[buffer\_init(3)](/buffer_init/3.md)
