Mercurial > libguess
comparison test.c @ 4:ff05c6c659cb
added test.c.
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Thu, 12 Jun 2008 20:22:07 +0900 |
parents | |
children | 8a64459dab94 |
comparison
equal
deleted
inserted
replaced
3:70e2c306231e | 4:ff05c6c659cb |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.h> | |
3 #include <string.h> | |
4 #include "libguess.h" | |
5 | |
6 int main(int argc, char **argv) | |
7 { | |
8 FILE *fp; | |
9 char buf[1024 * 1024]; | |
10 | |
11 if (argc != 2) | |
12 exit(1); | |
13 | |
14 fp = fopen(*(argv + 1), "r"); | |
15 if (!fp) { | |
16 printf("cannot open file \"%s\"\n", *(argv + 1)); | |
17 exit(1); | |
18 } | |
19 | |
20 //initialize libguess | |
21 guess_init(); | |
22 | |
23 while (fgets(buf, 1024 * 1024 - 1, fp)) { | |
24 // printf("%s\n", buf); | |
25 printf("length = %d\n", strlen(buf)); | |
26 printf("jp = %s\n", guess_jp(buf, strlen(buf))); | |
27 printf("tw = %s\n", guess_tw(buf, strlen(buf))); | |
28 printf("cn = %s\n", guess_cn(buf, strlen(buf))); | |
29 printf("kr = %s\n", guess_kr(buf, strlen(buf))); | |
30 printf("ru = %s\n", guess_ru(buf, strlen(buf))); | |
31 printf("ar = %s\n", guess_ar(buf, strlen(buf))); | |
32 printf("tr = %s\n", guess_tr(buf, strlen(buf))); | |
33 printf("gr = %s\n", guess_gr(buf, strlen(buf))); | |
34 printf("hw = %s\n", guess_hw(buf, strlen(buf))); | |
35 } | |
36 fclose(fp); | |
37 } |