[omniORB] omniORB.CORBA.BAD_PARAM

Duncan Grisby dgrisby@uk.research.att.com
Thu, 15 Nov 2001 10:49:36 +0000


On Wednesday 14 November, Paul Brannan wrote:

> Unfortunately, that's not an option for me.  In C++, I can do:
> 
>   Test::Bar b;
>   std::strncpy(b.str, "testing", sizeof(b.str));
>   b.str[sizeof(b.str)-1] = '\0';

You do realise that this copies a couple of bytes of arbitrary memory
into the str field... Whatever followed the "testing" string.

> In python, then, it seems I can do:
>   b = Test.Bar('testing\0  ')
> 
> Short of writing a helper function, is there any other way to do this?

No.

Are you stuck with that IDL definition because it's already deployed
somewhere?  If you just want to limit the string length to 10, you can
use a bounded string.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --