Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Mar 2004 12:52:19 +0800
From:      "Zhang Weiwu" <weiwuzhang@hotmail.com>
To:        questions@freebsd.org
Subject:   [OT?] write C program with UTF16LE
Message-ID:  <BAY16-F44OYFSrAuWiq000092b1@hotmail.com>

next in thread | raw e-mail | index | archive | help
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  



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BAY16-F44OYFSrAuWiq000092b1>