Avoid signed/unsigned char pitfalls when calling viet_is* functions
[vspell.git] / utils / utf8toviscii.cpp
blobc5d1aa436259ad27fdcef31a8766e871f4eeef5c
1 #include <iostream>
2 #include <string>
3 #include "vspell.h"
4 using namespace std;
5 extern void viet_init();
6 int main(int argc,char **argv)
8 string s;
10 viet_init();
11 bool revert = argc > 1 && string(argv[1]) == "-r";
13 if (revert) {
14 while (getline(cin,s)) {
15 char *ss = new char[s.size()*3+1];
16 viet_viscii_to_utf8(s.c_str(),ss);
17 cout << ss << endl;
18 delete[] ss;
21 else {
22 while (getline(cin,s)) {
23 char *ss = new char[s.size()+1];
24 viet_utf8_to_viscii(s.c_str(),ss);
25 cout << ss << endl;
26 delete[] ss;
29 return 0;