[DGD]hmm.. this seems to not be goin through...

John West McKenna john at ucc.gu.uwa.edu.au
Wed Apr 26 05:27:14 CEST 2000


BladeDarkmour at aol.com writes:

>    char ch, *tmptxt;
..
>            tmptxt[k++] = txt[i];

Bang!  Here's your problem.  char *tmptxt defines tmptxt as a pointer to
a string.  It doesn't allocate any storage for the string.  You need to
allocate some space with malloc(), and make sure it gets freed at some
point.  LPC has garbage collection and will do this for you.  C doesn't.

Also, LPC strings are probably stored in a different way to C strings.
Null is a legal character in an LPC string, isn't it?  That would imply
they're stored with a separate length, instead of C's null-terminating
bogosity.  And there's probably reference counts and other stuff for
garbage collection.  I've never looked at the driver source, but I'd be
very surprised if you can take strings from LPC and expect them to look
like C strings.

In any case, you shouldn't be modifying the driver unless you're doing
something that genuinely can't be done in LPC.  It's only asking for
trouble when you try to upgrade to a new version of the driver.

John West

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list