array of string

John (J5) Palmieri johnp at redhat.com
Sun Oct 30 08:06:24 PST 2005


On Sat, 2005-10-29 at 21:51 -0500, yohann (yrc) coppel wrote:
> 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]);
> 

That is just confusing.  You need to break thing out a bit.  Without
knowing exactly how you initialized the info structure it will be hard
to find out what is going on there.  Why are you using a void * instead
of a char ** and do you have enough space to hold what is being passed
into argv[1]?  BTW you most likely don't have to copy the string and can
just set the pointer in your array, just don't free it.  If the array
contains other allocated memory that needs to be freed then you will
have to make a copy in which case I suggest doing it in steps.  First
make the copy and then assign it into your list.
 
-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list