[OT?] write C program with UTF16LE

Zhang Weiwu weiwuzhang at hotmail.com
Sun Mar 14 20:52:20 PST 2004


Hello. Although I write some php/perl script, I don't write C program. Now 
I have a very large text file in UTF16LE format, the rule is strings are 
seperated by numbers. Say

0300 6100 6200 6300 0400 6700 5400 9800 7400 0300 ....

Leading 0300 means the following 3 characters (6 bytes) is a string, and 
the next 0400 means the following 4 characters makes another string.

I need to read the file and replace every number-style string seperator 
with a linefeed. I decide to use C, it is a good chance to start some 
practice on C. The old getc() I learnt from school is not my cup of tea, 
because I always need to do two getcs at once, and for the seperators I 
need to do getc()+getc()*256. What is the best practics to deal with such 
number/UTF16 mixed text? 

I googled around and find some tutorials, most i18n toturials think I'm 
already a C expert:( I find the glibc manual looks good learning resource, 
but I am the kind of newbie don't know if I am using glibc at all. When I 
just write 
#include <stdio.h>
Am i using the stdio.h from glibc?

I think simply point me a tutorial that fits me will do me more help.

Thank you.

_________________________________________________________________
ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà MSN Messenger:  http://messenger.msn.com/cn  



More information about the freebsd-questions mailing list