PageRenderTime 23ms CodeModel.GetById 14ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/tools/fontextract/unicode.c

http://ftk.googlecode.com/
C | 43 lines | 35 code | 8 blank | 0 comment | 6 complexity | 16509cc084b76fb5eddcb193dbd88c21 MD5 | raw file
 1#include <stdio.h>
 2
 3void gen_ascii(FILE* fp)
 4{
 5	unsigned short ch = 0x20;
 6	for(; ch < 127; ch++)
 7	{
 8		fwrite(&ch, sizeof(ch), 1, fp);
 9	}
10}
11
12void gen_cjk(FILE* fp)
13{
14	unsigned short ch = 0;
15	
16	for(ch = 0x4E00; ch <= 0x9FA5; ch++)
17	{
18		fwrite(&ch, sizeof(ch), 1, fp);
19	}
20	return;
21}
22
23int main(int argc, char* argv[])
24{
25	FILE* fp = fopen("ascii.txt", "wb+");
26	
27	if(fp != NULL)
28	{
29		gen_ascii(fp);
30		fclose(fp);
31	}
32	
33	fp = fopen("unicode.txt", "wb+");
34	
35	if(fp != NULL)
36	{
37		gen_ascii(fp);
38		gen_cjk(fp);
39		fclose(fp);
40	}
41
42	return 0;
43}