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

# fmt\_pad(3)

pad a string with spaces.

## NAME

fmt\_pad - pad a string with spaces.

## SYNTAX

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

size\_t **fmt\_pad**(char \**dest*, const char \**source*,\
       size\_t *srclen*, size\_t *padlen*,\
       size\_t *maxlen*);

## DESCRIPTION

fmt\_pad writes *padlen*-*srclen* spaces (if that number is positive) and then *srclen* characters from *source*.  It truncates the output only if the length would exceed *maxlen*.

It returns the number of bytes it wrote.

fmt\_pad does not append \\0.

If *dest* equals FMT\_LEN (i.e. is zero), fmt\_pad returns the number of bytes it would have written.

## SEE ALSO

[fmt\_strn(3)](/fmt_strn/3.md), [fmt\_fill(3)](/fmt_fill/3.md)
