Hi Candy, Candy Chiu <candy.chiu.ad at gmail.com> writes: > if (n > c) // <------------- if (n * sizeof(ucs2_char) > c) ... The buffer capacity (c) here is in 2-byte characters, not bytes. Boris