[omniORB] String Handling
Duncan Grisby
duncan at grisby.org
Tue Mar 29 22:52:34 BST 2005
On Saturday 26 March, "Swapnil Wale" wrote:
> I am new to CORBA. I need some help on how to pass strings from a client
> to server. So far I used to pass strings from a c++ client by...
>
> CORBA::WStringValue_var msg = new CORBA::WStringValue((const
> CORBA::WChar*)L"My Message.....");
Just for clarity, that is not a string. It is a wide string inside a
value box. If you're using that with omniORB, you must be using the
omniORB 4.1 pre-release.
> This works fine but now I need to pass some values that I get from a
> database. How can I pass those values if I use a variable to store those
> values? I looked at some examples but most of them are similar to the above
> example.
>
> If I have a string variable
>
> A = "Hello World";
>
> how can I send it to the server?
This one is a string, not a wide string. If you want to send it as a
wstring, you have to convert it. The ORB won't do it for you.
Aside from that, you just need to create a WStringValue using a suitable
constructor, giving it either a wchar_t* or a const wchar_t*, depending
on whether you want it to take ownership of the wstring or not, then
pass it to the operation.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
More information about the omniORB-list
mailing list