int ch = getnextchar(const char *s, int *idx);
s from the byte offset pointed to by idx. Upon return, the
integer pointed to by idx is increased by the number of bytes read. In UTF-8, this can
be up to 4 bytes per character. s must be a valid UTF-8 string.
This function can be used to easily read all individual Unicode characters from a UTF-8 string like so:
int i = 0;
while(s[i]) {
printf("Got character: %d\n", getnextchar(s, &i));
}
|