Wow, what's the record for the biggest amount of posts on the same part of the same program? Here I am again...making progress, but now I can't figure out why Chinese Win98 will display the characters (in DOS) in the one program but not in the other. I'm still toying with the idea of wchar_t but I guess I'd have to install XP for that one as Unicode only works with the NT kernel.
OK, here's the program that displays characters correctly in Chinese Win98/DOS using getline():
Code:
#include <iostream>
#include <cstdlib>
#include <fstream>
using namespace std;
int main()
{ char arry[12][120];
int count = -1;
cout << "Loading radicals3.txt into the array...\n" << endl;
ifstream infile("radicals3.txt");
for(int a=0; a<12; a++)
{ infile.getline(arry[++count], 120, '\n');
}
for(int b=0; b<7; b++)
{ cout << "\narry [" << b << "] [" << arry[b]
<< "]" << endl;
}
system("pause");
for(int b=7; b<12; b++)
{ cout << "\narry [" << b << "] [" << arry[b]
<< "]" << endl;
}
system("pause");
return 0;
}
Now here's the code (using get()) for the section of my program that will load in letters of the alphabet and display them perfectly but won't load(?) or display when I try it with Chinese characters:
Code:
void Hanzi::DisplayRads(int r)
{
ifstream infile;
ostringstream name;
//int i = r;
name << r << "str.txt" << flush;
cout << "\nname is " << name.str() << "\n" << endl;
string name2 = name.str();
infile.open(name2.c_str());
if(!infile)
cout << "Aw, bummer, the file didn't open!\n";
else
{ char arry[120];
//infile.getline(arry[0], 60, '\n');
char ch;
//long index = 0;
//infile >> ch;
for(int c=0; c<120; c++) //this lets it feed in one char @ a time
infile.get(arry[c]);
//while(!infile.eof())
//{
// arry[index++] = ch;
//}
for(int b=0; b<20; b++)
{ if((b==0) || (b%2 == 0))
cout << b+1 << ". " << arry[b];
else
cout << "\t" << b+1 << ". " << arry[b] << endl;
}
} //if(infile) else
infile.close();
} //Hanzi::DisplayRads
Any ideas? Thanks guys. I love this board!
Swaine777