Internationalization and localization tools


String Format Function

int asprintf(char **ptr, const char *template, ...);

Internationalization (I18n) Function Overview

The asprintf function is similar to sprintf, except that it dynamically allocates a string to hold the output, instead of putting the output in a buffer allocated in advance. The ptr argument should be the address of a char* object, and asprintf stores a pointer to the newly allocated string at that location.

I18n Issues

There is no ANSI wide character version of this function. The parameters will have to be converted to multibyte UTF-8 characters and then the asprintf function can be used.

Prior to calling this function, ensure that the current locale is set properly by calling setlocale, as string formatting is dependent on the LC_NUMERIC locale category. See String Formatting in C and C++ for a discussion on locale-sensitive formatting in internationalized applications.

Recommended Replacements*

*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.

String Format Functions

 

Lingoport internationalization and localization services and software