I'm trying to send a "string" from a C++ client to a Java server. On the server-side the username is a String
. In my IDL it's a WStringValue
, so I have to send the username as a WStringValue
from my client. The following code works fine on both sides:
const CORBA::WChar* usern = (wchar_t*)L"Chuck Norris";
CORBA::WStringValue* username = new CORBA::WStringValue(usern);
But I want to get the user name from the keyboard... Now, my question is how to convert the char[]
to a Wchar*
? After my experiments, it seems there is a problem with encoding too..
cout << "Please type your Username: " << endl;
fgets(input, MAX_LINE, stdin);
strcpy(username, input);
const CORBA::WChar* usern = (wchar_t*)username;
CORBA::WStringValue* username = new CORBA::WStringValue(usern);
How can I do this?