---
name: "uszprintf"
section: "3alleg"
platform: "linux"
package: "liballegro-doc"
version: "2:4.2.2-2.2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/uszprintf"
---

# uszprintf(3alleg)

Writes formatted data into a buffer, specifying size. Allegro game programming library.

## NAME

uszprintf - Writes formatted data into a buffer, specifying size. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**int uszprintf(char \*buf, int size, const char \*format, ...);**

## DESCRIPTION

This function writes formatted data into the output buffer, whose length in bytes is specified by \`size' and which is guaranteed to be NULL terminated. Example:

```
   char buffer[10];
   int player_score;
   ...
   uszprintf(buffer, sizeof(buffer), "Your score is: %d", player_score);
```

## RETURN VALUE

Returns the number of characters that would have been written without eventual truncation (like with usprintf), not including the terminating null character.

## SEE ALSO

[**uconvert**(3alleg)](/uconvert/3alleg.md), [**usprintf**(3alleg)](/usprintf/3alleg.md), [**uvszprintf**(3alleg)](/uvszprintf/3alleg.md), [**exgui**(3alleg)](/exgui/3alleg.md)
