usetat(3) Replaces a character in a string. Allegro game programming library.


#include <allegro.h>

int usetat(char *s, int index, int c);


Replaces the character at the specified index in the string with value `c', handling any adjustments for variable width data (ie. if `c' encodes to a different width than the previous value at that location). If `index' is negative, it counts backward from the end of the string. Example:

   usetat(text_string, 2, letter_a);


Returns the number of bytes by which the trailing part of the string was moved. This is of interest only with text encoding formats where characters have a variable length, like UTF-8.