OK, i was trying to load 188 character radicals (each Chinese character has a base part called a radical) into an array, line by line. There are 12 sets of radicals, 1 to 12 according to how many strokes are in the radical. I was thinking maybe it would be better to just have 12 text files and only load the set of radicals that you want to use at runtime instead of loading all 12 sets. I did get it to load all 12 sets and it worked pretty well except for the 3 stroke radical set which had a few characters about three quarters of the way through display as chinese characters that didn't belong there, as blank spaces, or as some funky ascii characters and then the last few characters in the radical set displayed correctly on the end.
Anyway, I've tried just loading one set at a time and it works for the smaller sets but not the bigger sets. For the bigger sets it displays most of them along with some empty space and a funky ascii char or 2 (in Chinese DOS). I'm guessing that each chinese character takes up 2 bytes instead of 1 for an ascii char so I'm going to have to figure out how to load an array (or vector, once i figure how to use 'em) with 2 byte characters and be able to sort, display, etc. I'm thinking that wchar_t is my best option, along with trying to write a windows/Unicode program that handles the Chinese characters easily. I've also read that trying to do this in my OS (98se) is not as easy as with Win2k and NT. I've been reading about Unicode, writing Windows programs in C++ (thought there's not a whole lot of clear guidance on that one, esp. if you're using dev-cpp), and trying to find tutorials on wchar_t.
Some people are telling me that I should just write this program in Java or VB with unicode but I've been studying C++ and I really don't want to study more than one language at a time or skip completely to another language. Besides, I really like C++. I just like the style of C++ and I'm starting to comprehend most of the basics.
Thanks a lot for any advice you can offer.
Code:
//FeedRadArray.cpp
//it compiles and works!!! Woohoo!!!
//the cin.getline() function with 3 parameters
//works beautiful except for a few of the characters in the
//3 stroke radical category
#include <iostream>
#include <cstdlib>
#include <fstream>
using namespace std;
int main()
{ char arry[12][120];
int count = 0;
cout << "Loading radicals3.txt into the array...\n" << endl;
ifstream infile("radicals3.txt");
for(int a=0; a<13; a++)
{ infile.getline(arry[a], 120, '\n');
}
for(int b=0; b<6; b++)
{ cout << "\narry [" << b << "] " << arry[b] << endl;
}
system("pause"); //so i can see it all on the DOS screen b4 it disappears
for(int b=7; b<12; b++)
{ cout << "\narry [" << b << "] " << arry[b] << endl;
}
system("pause");
return 0;
}