array of string

yohann (yrc) coppel yohann at varyoh.com
Sun Oct 30 08:37:35 PST 2005


Le dimanche 30 octobre 2005 à 11:06 -0500, John (J5) Palmieri a écrit :
> 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 **

I'm in a sqlite callback. it's the definition.

> and do you have enough space to hold what is being passed
> into argv[1]?

yes. i check it.

>  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. 

I know, i just wasn't sure if sqlite was making the free for me.

> 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.
>  

Well, i'm still searching, and i think i've some problem with the
accents in my strings....

I'm making some tests, i post my results later...

thanks for your help... i gona post somewhere else if it's not anymore
in DBus subject...

(and yes, my code now is realy realy dirty:
http://www.varyoh.com/upload/desktop-20051030102653.png
but it's the result of 3 days of intense debugging ;-)... i'm going to
clean it...)



More information about the dbus mailing list