Mercurial > libguess
changeset 4:ff05c6c659cb
added test.c.
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Thu, 12 Jun 2008 20:22:07 +0900 |
parents | 70e2c306231e |
children | 8a64459dab94 |
files | test.c |
diffstat | 1 files changed, 37 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test.c Thu Jun 12 20:22:07 2008 +0900 @@ -0,0 +1,37 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "libguess.h" + +int main(int argc, char **argv) +{ + FILE *fp; + char buf[1024 * 1024]; + + if (argc != 2) + exit(1); + + fp = fopen(*(argv + 1), "r"); + if (!fp) { + printf("cannot open file \"%s\"\n", *(argv + 1)); + exit(1); + } + + //initialize libguess + guess_init(); + + while (fgets(buf, 1024 * 1024 - 1, fp)) { +// printf("%s\n", buf); + printf("length = %d\n", strlen(buf)); + printf("jp = %s\n", guess_jp(buf, strlen(buf))); + printf("tw = %s\n", guess_tw(buf, strlen(buf))); + printf("cn = %s\n", guess_cn(buf, strlen(buf))); + printf("kr = %s\n", guess_kr(buf, strlen(buf))); + printf("ru = %s\n", guess_ru(buf, strlen(buf))); + printf("ar = %s\n", guess_ar(buf, strlen(buf))); + printf("tr = %s\n", guess_tr(buf, strlen(buf))); + printf("gr = %s\n", guess_gr(buf, strlen(buf))); + printf("hw = %s\n", guess_hw(buf, strlen(buf))); + } + fclose(fp); +}