Greg Ercolano wrote:
> Albrecht Schlosser wrote:
>>>>> // Assume pairs of bytes: <char> <nul> <char> <nul> .. <nul> <nul>
>>>>> void multibyte_convert(const char *in, char *out)
>>>>> {
>>>>> for ( ; *in; out++, in+=2 )
>>>>> { *out = *in; }
>>>>> }
>>>>> to Greg: wouldn't the above code miss the trailing zero byte?
>
> Fortunately the article is editable ;)
This is probably better.. I even tested it this time ;)
------------------------------------------------------------------
// Assume pairs of bytes: <char> <nul> <char> <nul> .. <nul> <nul>
void multibyte_convert(const char *in, char *out)
{
for ( *out = *in; *in; )
{ out++; in += 2; *out = *in; }
}
------------------------------------------------------------------
I applied this fix to the article's comments, so it should be
correct now.
Thanks Albrecht, good catch.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk