---
name: "libwget-printf"
section: "3"
platform: "linux"
package: "wget2-dev"
version: "2.2.0+ds-1+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/libwget-printf"
---

# libwget-printf(3)

Libwget printf functions

## NAME

libwget-printf - Libwget printf functions

## SYNOPSIS

### Functions

size\_t **wget\_vasprintf** (char \*\*strp, const char \*fmt, va\_list args)\
 size\_t **wget\_asprintf** (char \*\*strp, const char \*fmt,...)\
 char \* **wget\_vaprintf** (const char \*fmt, va\_list args)\
 char \* **wget\_aprintf** (const char \*fmt,...)\
 size\_t **wget\_vfprintf** (FILE \*fp, const char \*fmt, va\_list args)\
 size\_t **wget\_fprintf** (FILE \*fp, const char \*fmt,...)\
 size\_t **wget\_printf** (const char \*fmt,...)\
 size\_t **wget\_vsnprintf** (char \*str, size\_t size, const char \*fmt, va\_list args)\
 size\_t **wget\_snprintf** (char \*str, size\_t size, const char \*fmt,...)\

## Detailed Description

This is a collection of printf-style functions that are used with libwget and/or Wget2 code. They may be useful to other developers that is why they are exported.

## Function Documentation

### size\_t wget\_vasprintf (char \*\* strp, const char \* fmt, va\_list args)

**Parameters**

*strp* Pointer to hold the string output \
 *fmt* Printf-like format specifier \
 *args* va\_list of arguments

**Returns**

Length of the string returned via `strp` or `(size_t) -1` on error

Prints arguments to allocated memory and 0-terminates it. The string is returned via the first argument. It has to be free()'d by the caller when it is no longer needed.

### size\_t wget\_asprintf (char \*\* strp, const char \* fmt, ...)

**Parameters**

*strp* Pointer to hold the string output \
 *fmt* Printf-like format specifier \
 *...* List of arguments

**Returns**

Length of the string returned via `strp`

Prints arguments to allocated memory and 0-terminates it. The string is returned via the first argument. It has to be free()'d by the caller when it is no longer needed.

### char \* wget\_vaprintf (const char \* fmt, va\_list args)

**Parameters**

*fmt* Printf-like format specifier \
 *args* va\_list of arguments

**Returns**

Pointer to 0-terminated string in memory

Prints arguments to memory and returns a pointer to allocated and 0-terminated chunk of memory. The return value has to be free()'d by the caller when it is no longer needed.

### char \* wget\_aprintf (const char \* fmt, ...)

**Parameters**

*fmt* Printf-like format specifier \
 *...* List of arguments

**Returns**

Pointer to 0-terminated string in memory

Prints arguments to memory and returns a pointer to allocated and 0-terminated chunk of memory. The return value has to be free()'d by the caller when it is no longer needed.

### size\_t wget\_vfprintf (FILE \* fp, const char \* fmt, va\_list args)

**Parameters**

*fp* FILE pointer \
 *fmt* Printf-like format specifier \
 *args* List of arguments

**Returns**

Number of bytes written or -1 on error

Prints arguments to stream `fp` and returns number of bytes written.

### size\_t wget\_fprintf (FILE \* fp, const char \* fmt, ...)

**Parameters**

*fp* FILE pointer \
 *fmt* Printf-like format specifier \
 *...* List of arguments

**Returns**

Number of bytes written or -1 on error

Prints arguments to stream `fp` and returns number of bytes written.

### size\_t wget\_printf (const char \* fmt, ...)

**Parameters**

*fmt* Printf-like format specifier \
 *...* List of arguments

**Returns**

Number of bytes written or -1 on error

Prints arguments to `stdout` and returns number of bytes written.

### size\_t wget\_vsnprintf (char \* str, size\_t size, const char \* fmt, va\_list args)

**Parameters**

*str* Destination buffer \
 *size* Size of `str` \
 *fmt* Printf-like format specifier \
 *args* List of arguments

**Returns**

Number of bytes written, or, on truncation, that would have been written

Prints arguments to buffer `str` and returns number of bytes written, or on truncation: that would have been written.

If `str` is NULL the return value are the number of bytes that would have been written.

### size\_t wget\_snprintf (char \* str, size\_t size, const char \* fmt, ...)

**Parameters**

*str* Destination buffer \
 *size* Size of `str` \
 *fmt* Printf-like format specifier \
 *...* List of arguments

**Returns**

Number of bytes written, or, on truncation, that would have been written

Prints arguments to buffer `str` and returns number of bytes written, or on truncation: that would have been written.

If `str` is NULL the return value are the number of bytes that would have been written.

## Author

Generated automatically by Doxygen for wget2 from the source code.
