Problems with ndbm

doug at zaphod.prime.com doug at zaphod.prime.com
Tue Aug 8 00:40:00 AEST 1989


I judged that the storage used in the dptr value was probably reused.  I hadn't
made assumptions about the persistance of datum -> dptr. What happens is
something like:

datum *x;

x = dbm_fetch(thedb, thekey);

x -> dptr[x -> dsize] = '\0';

printf("%s\n", x -> dptr);  // Something is printed

x = dbm_fetch(thedb, thekey);

x -> dptr[x -> dsize] = '\0';

printf("%s\n", x -> dptr);  // Null is printed

------------------------------------------------------------------------------
Douglas Rand 
Internet:   doug at primerd.prime.com
Snail:	    Prime Computer, 500 Old Conn Path, MS10C-17, Framingham, Ma 01701
Disclaimer: PRIME doesn't believe a word I say, and fewer that I write.



More information about the Comp.unix.questions mailing list