Re: snprintf()

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 08/27/97

On Wed, 27 Aug 1997, Andrew Helm wrote:

>If I understand your problem correctly, this should work. When you
>create a buffer malloc() enough room for a header as well as the
>asked for size of the buffer. Store the header first, then return
>a pointer to the first char after the header. Functions that don't
>know any better will use it as a normal buffer. Functions that
>are supposed to take advantage of the header can access it by
>subtracting the sizeof the header from the buffer's pointer.
>For example:

I'd just throw (char *) casts around the buf_data structures if the buffer
was inside the structure but in this case it is malloc'd elsewhere.
This could work but it looks kind of ugly and was hoping for something
cleaner.  Although in this case perhaps there isn't much clean (except

 -- | Genius may have its limitations, but stupidity | is not thus handicapped. -- Elbert Hubbard

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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