Your company here — click to reach over 10,000 unique daily visitors

uconvert - Man Page

High level string encoding conversion wrapper. Allegro game programming library.


#include <allegro.h>

char *uconvert(const char *s, int type, char *buf, int newtype, int size);


Higher level function running on top of do_uconvert(). This function  converts the specified string `s' from `type' to `newtype', storing at most `size' bytes into the output `buf' (including the terminating null character), but it checks before doing the conversion, and doesn't bother if the string formats are already the same (either both types are equal, or one is ASCII, the other is UTF-8, and the string contains only 7-bit ASCII characters).

As a convenience, if `buf' is NULL it will convert the string into an internal static buffer and the `size' parameter will be ignored. You should be wary of using this feature, though, because that buffer will be overwritten the next time this routine is called, so don't expect the data to persist across any other library calls. The static buffer may hold less than 1024 characters, so you won't be able to convert large chunks of text. Example:

   char *p = uconvert(input_string, U_CURRENT, buffer, U_ASCII, 256);

Return Value

Returns a pointer to `buf' (or the static buffer if you used NULL) if a conversion was performed. Otherwise returns a copy of `s'. In any cases, you should use the return value rather than assuming that the string will always be moved to `buf'.

See Also

set_uformat(3), need_uconvert(3), uconvert(3), uconvert_ascii(3), uconvert_toascii(3), do_uconvert(3)

Referenced By

do_uconvert(3), need_uconvert(3), register_uformat(3), set_uformat(3), uatof(3), uconvert_ascii(3), uconvert_toascii(3), usprintf(3), ustrcat(3), ustrchr(3), ustrcmp(3), ustrcpy(3), _ustrdup(3), ustrdup(3), ustrerror(3), ustricmp(3), ustrlen(3), ustrlwr(3), ustrncat(3), ustrncmp(3), ustrncpy(3), ustrnicmp(3), ustrpbrk(3), ustrrchr(3), ustrstr(3), ustrtod(3), ustrtok(3), ustrtol(3), ustrupr(3), ustrzcat(3), ustrzcpy(3), ustrzncat(3), ustrzncpy(3), uszprintf(3), uvsprintf(3), uvszprintf(3).

version 4.4.3 Allegro manual