array of string

yohann (yrc) coppel yohann at varyoh.com
Sun Oct 30 06:56:27 PST 2005


Ok, It doesn't seems to be the problem, I've found something else:

if I do something like that:

	#define P (*((char***)info))[x]
	int j = 60;
	int jj = j > strlen(argv[i]) ? strlen(argv[i]) : j;
	P=(char*) calloc(jj+1,sizeof(char));
	if(P)
		strncpy(P, argv[i], jj);

(one more time, it's not a final code, just for debugging ;-) )
it works with my argv[i]. But, if I replace j = 60 by j = 61, it
doesn't! (all my testing strings are lager than 60 chars...)

So, is-it a DBus limitation ? What can-I do ?

Thanks!

yrc

Le samedi 29 octobre 2005 à 21:51 -0500, yohann (yrc) coppel a écrit :
> After searching all the day long, I've found something strange (for
> me...)
> 
> Somewhere in my code, I have:
> 
> strcpy((*((char***)info))[x], argv[i]);
> 
> With this line, I have the problem at the *reception* of the message...
> But, if I replace it (with the apropriate modification in the calloc
> arguments two lines before) by :
> 
> strcpy((*((char***)info))[x], "aaa"  );
> 
> I works fine !??!?!
> One more time:
> 
> strcpy((*((char***)info))[x], argv[i]);
> strcpy((*((char***)info))[x], "aaa"  );
> 
> ...!!!...
> with: char **argv
> 
> the void pointer info is more or less a pointer to the array I gona give
> to the function dbus_message_append_args later....
> 
> Is it one another very special thing of C... I don't know.... Or I'm too
> tired to see my error....
> 
> I've said at the *reception*, because if I do a dbus_message_get_args
> juste before sending the message in the server code (who send the
> message), i can read in both cases my strings... uh?
> 
> I don't know what to do... It's not realy a DBus problem but so now you
> can forget my previous messages...
> 
> Regards,
> yrc.
> 
> P.S. I've tried with memcpy, it's exactly the same result.
> 
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus



More information about the dbus mailing list