diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-06-16 23:14:30 +0000 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-06-16 23:14:30 +0000 |
commit | 3aa2acb1aa6931d9a5cab87fe9bef94086e25d16 (patch) | |
tree | c3b86c2f004e7a8498efbe41e72f42d81acde9ea /example | |
download | librcc-3aa2acb1aa6931d9a5cab87fe9bef94086e25d16.tar.gz librcc-3aa2acb1aa6931d9a5cab87fe9bef94086e25d16.tar.bz2 librcc-3aa2acb1aa6931d9a5cab87fe9bef94086e25d16.tar.xz librcc-3aa2acb1aa6931d9a5cab87fe9bef94086e25d16.zip |
Initial Import
Diffstat (limited to 'example')
-rw-r--r-- | example/Makefile | 10 | ||||
-rw-r--r-- | example/example.c | 31 | ||||
-rw-r--r-- | example/input.txt | 4 |
3 files changed, 45 insertions, 0 deletions
diff --git a/example/Makefile b/example/Makefile new file mode 100644 index 0000000..2504505 --- /dev/null +++ b/example/Makefile @@ -0,0 +1,10 @@ +all: example + +example: example.o + gcc -o example -lrcd example.o + +test: example + cat input.txt | ./example + +clean: + rm -f example example.o
\ No newline at end of file diff --git a/example/example.c b/example/example.c new file mode 100644 index 0000000..9666ae5 --- /dev/null +++ b/example/example.c @@ -0,0 +1,31 @@ +#include <stdio.h> +#include <string.h> +#include <librcd.h> + +main() { + enum russian_charsets res; + char buf[255]; + int l; + + while (fgets(buf,255,stdin)) { + if (strlen(buf)<2) break; + + res = get_russian_charset(buf,0); + switch(res) { + case RUSSIAN_CHARSET_WIN: + printf("CP1251: "); + break; + case RUSSIAN_CHARSET_ALT: + printf("CP866 : "); + break; + case RUSSIAN_CHARSET_KOI: + printf("KOI8-R: "); + break; + case RUSSIAN_CHARSET_UTF8: + printf("UTF8 : "); + break; + } + printf("%s",buf); + if (buf[strlen(buf)-1]!='\n') printf("\n"); + } +} diff --git a/example/input.txt b/example/input.txt new file mode 100644 index 0000000..8ea6e44 --- /dev/null +++ b/example/input.txt @@ -0,0 +1,4 @@ +ÐÒÉ×ÅÔ +ïðèâåò +¯à¨¢¥â +привет |