Re: Memory problems... in _doprnt()!?! (fwd)

From: Wout Mertens (Wout.Mertens@rug.ac.be)
Date: 10/18/95


On Tue, 17 Oct 1995, Billy H. Chan (~{3B:FH;~}) wrote:

> Thanks for all the helps and hints, esp. the course on gdb's bt and fr
> commands.  I'm happy to say that I found the memory problem.  I don't 
> know if I was just unlucky or silly, but in case someone else run into
> the same thing later on, this is one thing to look for:
> 
> In my code, I had a statement like:
> 	sprintf(buf, "This is the first statement,");
> 	sprintf(buf, " %s <STUFF STUFF STUFF>\r\n", buf);
> 
> I solved it by setting the first statement to sprintf to buf2 instead
> and incorporate buf2 into buf1 in the second sprintf.  So far, no
> crashes. 

how about: (READ THIS ALL YOU PEOPLE!!!! IT'S NOT LIKE I DIDN'T SEE THIS 
ALL OVER CIRCLE!!!!!) (I realize it won't get you a space in front, but I
think that's not the point)
(second statement) sprintf (buf+strlen(buf), " <STUFF.....")
it prints the string starting at buf[strlen(buf)], the trailing 0.

> An interesting thing I did:  When I added 2 long ints for AFFs and PREFs
> and MOB_flags and PLR_Flags, I had to reorganize the mob files.  Then, I
> realized I had to modify alll the mob files.  After some thinking, and
> because I wasn't good with sed/awk, I decided to make the db.c backwards
> compatible and put an extra sscanf check to switch between "old style"

Gekke Eekhoorn of BUG.



This archive was generated by hypermail 2b30 : 12/07/00 PST