[omniORB] Any and strings

Adrian Hamza ahamza@abb.dnttm.ro
Wed, 10 Nov 1999 12:34:29 +0200


I tried to use Any type with strings in omniORB 280 for C++. I did something
like this:

   CORBA::Any *any;
   any=new CORBA::Any;
   char* p = "XXX1";
   CORBA::Any::from_string y(p, 5,false);
   *any <<=y ; // I put a string into an Any.

    char *b;
    b=(char *)malloc(1000);
    CORBA::Any::to_string x(b,1000);
    *any>>=x; // I am trying to get the string out of the Any.
    int zzz;
    zzz=1;
    free(b);

Sometimes it works, sometimes it returns a NULL pointer.
Where am I wrong?
Thank you!

Adrian Hamza
Software Engineer
ABB Rometrics SRL
Calea Buziasului nr. 26
Timisoara 1900
Romania
      phone: +40 56 199 899
      fax: +40 56 193 737
      email: ahamza@abb.dnttm.ro
     AdrianHamza77@hotmail.com