I am trying to write a little program for myself, which is supposed to help with learning hiragana (some kind of japanese characters)
At one point the program is supposed to output a wchar_t which holds some hiragana characters. Let's use the following as an example:
wchar_t Hiragana[] = L"あいうえおかきくけこさしす せそ";
I tried many different things so far, the bestworking were:
1) for (int i=0; i<15; i++) cout << " " << Hiragana[i];
2) ofstream myfile;
myfile.open ("Hiragana.html ");
for (int i=0; i<15; i++) myfile << " " << Hiragana[i];
myfile.close();
3) FILE * pFile;
pFile = fopen ("hiragana.html ","w");
fwrite(Hiragana , sizeof(wchar_t) , 15, pFile);
fclose(pFile);
The first 2 are giving me the corresponding unicode numbers of the hiragana characters. When I exchange cout with wcout and ofstream with wofstream none of them outputs anything.
The third solution outputs a strange string like D0[0G0 etc. (a total of 15 symbols with a 0 attached, one for each hiragana character).
So my question is: what do I have to do to output hiragana characters? My guess is that the problem is with the output font, but I don't know how to handle fonts at all.
PS: I don't care if the output is in the console, a txt or a html file
PS²: I'm using Visual C++ 2008 Express Edition on Windows 7 64 Bit
At one point the program is supposed to output a wchar_t which holds some hiragana characters. Let's use the following as an example:
wchar_t Hiragana[] = L"あいうえおかきくけこさしす せそ";
I tried many different things so far, the bestworking were:
1) for (int i=0; i<15; i++) cout << " " << Hiragana[i];
2) ofstream myfile;
myfile.open ("Hiragana.html ");
for (int i=0; i<15; i++) myfile << " " << Hiragana[i];
myfile.close();
3) FILE * pFile;
pFile = fopen ("hiragana.html ","w");
fwrite(Hiragana , sizeof(wchar_t) , 15, pFile);
fclose(pFile);
The first 2 are giving me the corresponding unicode numbers of the hiragana characters. When I exchange cout with wcout and ofstream with wofstream none of them outputs anything.
The third solution outputs a strange string like D0[0G0 etc. (a total of 15 symbols with a 0 attached, one for each hiragana character).
So my question is: what do I have to do to output hiragana characters? My guess is that the problem is with the output font, but I don't know how to handle fonts at all.
PS: I don't care if the output is in the console, a txt or a html file
PS²: I'm using Visual C++ 2008 Express Edition on Windows 7 64 Bit
Comment