Re: Corba_string object



Thanks for your reply.

So for a CORBA_string object I should use first the
allocate function and then the dup function?

struct employee myemp;
myemp.name = CORBA_string_alloc(7);
myemp.name = CORBA_string_dup("someone");

Is CORBA_string nothing more than a typedef for
CORBA_char*?

--- Jan Kratochvil <lace@jankratochvil.net> wrote:
> Hi,
> 
> On Fri, 14 Nov 2003 17:59:42 +0100, some one wrote:
> ...
> > struct employee
> > {
> >     CORBA_string name;
> > }
> > 
> > Can I just do this?
> > 
> > struct employee thisemployee;
> > thisemployee.name = "someone";
> 
> Only as long as you do not permit any CORBA/ORBit to
> free it.
> 
> Otherwise / the more correct way is to use:
> 
>
/usr/include/orbit-2.0/orbit/orb-core/corba-string.h:
> 	CORBA_char          *CORBA_string_dup  (const
> CORBA_char *str);
> or
> 	CORBA_char  *CORBA_string_alloc 
> (CORBA_unsigned_long len);
> 
> therefore
> 	thisemployee.name = CORBA_string_dup ("someone");
> 
> 
> 
> Regards,
> Lace
> 
> -- 
> Jan Kratochvil; Captive: free r/w NTFS Filesystem;
http://www.jankratochvil.net/


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]