Re: string handling problem



Hi Peter,

On Mon, 2003-04-14 at 13:44, Peter Van Osta wrote:
> I have been reading manuals and the list archive, but I just can't get
> the string handling right. I can't get the server to return a string as
> part of the function arguments ( see below) ? I don't get the string
> back, but always another string which was "filled' before. how to let a
> server fill/copy/manipulate a string and have it back ?

	Have you read test/everything ? that has a whole load of client /
server code doing the most twisted things around, you might want to copy
that.

> This is only a small test, because the next thing is to be able to send
> and receive sequences for images. 

	Sounds fun :-)

> static CORBA_short
> impl_MyServer_MyStringSendReceive(impl_POA_MyServer * servant,
> 				      CORBA_char * mystr,
> 				      CORBA_char ** message,
> 				      CORBA_Environment * ev)
> {

	This all looks fine:

> 	fprintf( stdout,"Received request...\n" );
> 	g_message( "[server] %s", mystr );
> 	*message = CORBA_string_alloc( 63);
> 	*message = CORBA_string_dup( mystr );

	You leak some memory here; but that shoudl essentially return the
incoming string in 'message';

	Is that not what you're trying to achieve ? of course, perhaps there's
a problem in the client code somewhere (?).

	Regards,

		Michael.

-- 
 mmeeks@gnu.org  <><, Pseudo Engineer, itinerant idiot




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