---
name: "gl_printf"
section: "3vga"
platform: "linux"
package: "svgalibg1-dev"
version: "1:1.4.3-7"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/gl_printf/3vga"
---

# gl\_printf(3vga)

write formatted output in graphic mode

## NAME

gl\_printf - write formatted output in graphic mode

## SYNOPSIS

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

**int gl\_printf(int** *x***, int** *y***, const char \****fmt***, ...);**

## DESCRIPTION

**gl\_printf** writes, like **[printf(3)](/printf/3.md)** a formatted string to position (*x*, *y*) using the currently selected font. If one or both of  *x* and *y* is negative, the text printing continues at the last position. The special characters **\\b**, **\\r**,  **\\n**, **\\a**,  **\\t** and **\\v** have the usual effects.

Printing wraps at the screen borders. Nevertheless, behaviour is undefined if not a single characters fits on the screen or if the initial position is outside the screen.

The kind of text draw operation is set with [**gl\_setwritemode**(3)](/gl_setwritemode/3.md).

**BEWARE!** Prior to the of use of [**gl\_printf**(3)](/gl_printf/3.md) you must set a font.

A good default initialization sequence is:

**gl\_setfont(8, 8, gl\_font8x8);**\
 **gl\_setwritemode(FONT\_COMPRESSED + WRITEMODE\_OVERWRITE);**\
 **gl\_setfontcolors(0, vga\_white());**\

## RETURN VALUE

The number of characters printed.

## BUGS

For compatibility reasons this function is not contained in a.out libraries.

## SEE ALSO

[**printf**(3)](/printf/3.md), [**svgalib**(7)](/svgalib/7.md), [**vgagl**(7)](/vgagl/7.md), [**gl\_colorfont**(3)](/gl_colorfont/3.md), [**gl\_expandfont**(3)](/gl_expandfont/3.md), [**gl\_font8x8**(3)](/gl_font8x8/3.md), [**gl\_setfont**(3)](/gl_setfont/3.md), [**gl\_setfontcolors**(3)](/gl_setfontcolors/3.md), [**gl\_setwritemode**(3)](/gl_setwritemode/3.md), [**gl\_write**(3)](/gl_write/3.md), **gl\_writechar**(3), **printftest**(6).

## AUTHOR

This function and manual page was written by Trek \<trek00@freenet.hut.fi\> \<trek@mediaservice.net\>.
