How to Print

How to Print — Printing to streams

Functions

Includes

#include <libchimara/glk.h>

Description

You can print Latin-1 and Unicode characters, null-terminated strings, or buffers to any stream. The characters will be converted into the appropriate format for that stream.

Functions

glk_put_char ()

void
glk_put_char (unsigned char ch);

Prints one character to the current stream. As with all basic functions, the character is assumed to be in the Latin-1 character encoding. See Character Encoding.

Parameters

ch

A character in Latin-1 encoding.

 

glk_put_string ()

void
glk_put_string (char *s);

Prints a null-terminated string to the current stream. It is exactly equivalent to

1
2
for (ptr = s; *ptr; ptr++)
    glk_put_char(*ptr);

However, it may be more efficient.

Parameters

s

A null-terminated string in Latin-1 encoding.

 

glk_put_buffer ()

void
glk_put_buffer (char *buf,
                glui32 len);

Prints a block of characters to the current stream. It is exactly equivalent to:

1
2
for (i = 0; i < len; i++)
    glk_put_char(buf[i]);

However, it may be more efficient.

Parameters

buf

An array of characters in Latin-1 encoding.

 

len

Length of buf .

 

glk_put_char_stream ()

void
glk_put_char_stream (strid_t str,
                     unsigned char ch);

The same as glk_put_char(), except that you specify a stream str to print to, instead of using the current stream. It is illegal for str to be NULL, or an input-only stream.

Parameters

str

An output stream.

 

ch

A character in Latin-1 encoding.

 

glk_put_string_stream ()

void
glk_put_string_stream (strid_t str,
                       char *s);

The same as glk_put_string(), except that you specify a stream str to print to, instead of using the current stream. It is illegal for str to be NULL, or an input-only stream.

Parameters

str

An output stream.

 

s

A null-terminated string in Latin-1 encoding.

 

glk_put_buffer_stream ()

void
glk_put_buffer_stream (strid_t str,
                       char *buf,
                       glui32 len);

The same as glk_put_buffer(), except that you specify a stream str to print to, instead of using the current stream. It is illegal for str to be NULL, or an input-only stream.

Parameters

str

An output stream.

 

buf

An array of characters in Latin-1 encoding.

 

len

Length of buf .

 

glk_put_char_uni ()

void
glk_put_char_uni (glui32 ch);

Prints one character to the current stream. The character is assumed to be a Unicode code point. See Character Encoding.

Parameters

ch

A Unicode code point.

 

glk_put_string_uni ()

void
glk_put_string_uni (glui32 *s);

Prints a string of Unicode characters to the current stream. It is equivalent to a series of glk_put_char_uni() calls. A string ends on a glui32 whose value is 0.

Parameters

s

A zero-terminated string of Unicode code points.

 

glk_put_buffer_uni ()

void
glk_put_buffer_uni (glui32 *buf,
                    glui32 len);

Prints a block of Unicode characters to the current stream. It is equivalent to a series of glk_put_char_uni() calls.

Parameters

buf

An array of Unicode code points.

 

len

Length of buf .

 

glk_put_char_stream_uni ()

void
glk_put_char_stream_uni (strid_t str,
                         glui32 ch);

The same as glk_put_char_uni(), except that you specify a stream str to print to, instead of using the current stream. It is illegal for str to be NULL, or an input-only stream.

Parameters

str

An output stream.

 

ch

A Unicode code point.

 

glk_put_string_stream_uni ()

void
glk_put_string_stream_uni (strid_t str,
                           glui32 *s);

The same as glk_put_string_uni(), except that you specify a stream str to print to, instead of using the current stream. It is illegal for str to be NULL, or an input-only stream.

Parameters

str

An output stream.

 

s

A null-terminated array of Unicode code points.

 

glk_put_buffer_stream_uni ()

void
glk_put_buffer_stream_uni (strid_t str,
                           glui32 *buf,
                           glui32 len);

The same as glk_put_buffer_uni(), except that you specify a stream str to print to, instead of using the current stream. It is illegal for str to be NULL, or an input-only stream.

Parameters

str

An output stream.

 

buf

An array of Unicode code points.

 

len

Length of buf .