[omniORB] copying strings

Joan Ramon López Gillué jrlopez@visionadvance.com
Sun, 22 Apr 2001 15:51:15 +0200


Hello everybody,

Please, can anybody tell me what am I doing wrong in thye following fragment
of code?

The problem is with copyinn nameBuf over (*name)[0].kind. If instead of
copying nameBuf, I copy a (const char *), as in the previous line,
everything works fine.


#include <omniORB3/CORBA.h>

void main(int argc, char** argv) {

	CosNaming::Name* name;
	char nameBuf[15]="Hola";

	name = new CosNaming::Name(0);

	name->length(1);
	(*name)[0].id = (const char*)"id0";
	(*name)[0].kind = CORBA::string_dup(&(nameBuf[0]));

	name->length(2);		// it crashes here !!!

	etc...
}


Many thanks in advance

Joan Ramon Lopez Gillue