uvszprintf(3alleg)

uvszprintf3alleg

Writes formatted data into a buffer, using size and variable arguments. allegro game programming library.

Usage

#include <allegro.h>

int uvszprintf(char *buf, int size, const char *format, va_list args);

Overview

This is like uszprintf(), but you pass the variable argument list directly, instead of the arguments themselves. Example:

   #include <stdarg.h>
   void log_message(const char *format, ...)
   {
      char buffer[100];
      va_list parameters;
      va_start(parameters, format);
      uvszprintf(buffer, sizeof(buffer), format, parameters);
      va_end(parameters);
      append_buffer_to_logfile(log_name, buffer);
      send_buffer_to_other_networked_players(multicast_ip, buffer);
      and_also_print_it_on_the_screen(cool_font, buffer);
   }
   void some_other_function(void)
   {
      log_message("Hello %s, are you %d years old?\n", "Dave", 25);
   }

Return value

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

Releases

4 releases since Debian 3.1 (Sarge); the text changed 2 times.

  1. 3.1
  2. 4.0
  3. 5.0–6.0

From liballegro-doc 2:4.2.2-2.2 in Debian 6.0 (Squeeze). Parsed by carta from the page's man source.