Nibble Guru - Computing queries demystified Sunday, November 23, 2008
Home
My Account / Register
Login / Logout
Post your Problem!
Search

About Us
Contact Us



List Home > Programming / Scripting > C/C++ >   [ Post New Problem ]

Welcome back !
TrackingID : 1510
Posted : Saturday, May 01st, 2004 04:12:00 AM
By : newix
International characters in a console windowConfiguration:
Hello there,

Here in Belgium we use land code 850 and an Azerty keyboard. When using a console program written in C++ (Visual Studio 6.0), we get the wrong output:
----------------------------------------------------
#include
using namespace std;
int main(){
cout
#include
#include
using namespace std;
//Override operator<< of ostream
ostream& operator<<(ostream & os, char* szSource) {
TCHAR szDestination[260] = "";
CharToOem(szSource, szDestination);
printf(szDestination);
return os;
}
int main() {
cout << "hélène\n";
return 0;
}
// output: hélène
----------------------------------------------------
Of course, this is not a perfect solution. For instance, if the string to be printed is longer than 260 characters, the program fails.

There must be a setting somewhere in the register that fixes this problem for once and for all, I guess. So that the first program always works in our country. Is there somebody with a better solution than ours? Thank you.
Operating System : XP Pro SP1
CPU/Processor : AMD Athlon 1400 MHz
RAM : Actual:256 MB
Hard Disk : , Space: 120 GB

Related Problems :
Comments :
Re: International characters in a console window by newix on May 01st, 2004 04:30:24 AM
Oh boy, this question is really messed up. How can I post a program list so that it can be read?

Related Problems :
Post a Note :
UserName (not required in anonymous posts)
Password (not required in anonymous posts)
Post Anonymous (check this only if you wish to post anonymously.)
Subject
Comment (limited HTML allowed)



List Home > Programming / Scripting > C/C++ >   [ Post New Problem ]
Copyright © 2001-2008, Nibble Guru