summaryrefslogtreecommitdiffstats
path: root/example/example.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2005-06-16 23:19:27 +0000
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2005-06-16 23:19:27 +0000
commit70fbe7822024d0acc68df3607ff25bf8d7a71751 (patch)
tree553cd2ef8cfc936fc890113596db2c4478fe5163 /example/example.c
downloadlibrcd-70fbe7822024d0acc68df3607ff25bf8d7a71751.tar.gz
librcd-70fbe7822024d0acc68df3607ff25bf8d7a71751.tar.bz2
librcd-70fbe7822024d0acc68df3607ff25bf8d7a71751.tar.xz
librcd-70fbe7822024d0acc68df3607ff25bf8d7a71751.zip
initial import
(automatically generated log message)
Diffstat (limited to 'example/example.c')
-rw-r--r--example/example.c31
1 files changed, 31 insertions, 0 deletions
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");
+ }
+}