Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!lll-winken!sun-barr!newstop!sun!amdcad!dgcad!dg-rtp!usenet From: vook@narnia.rtp.dg.com (Eric R Vook) Newsgroups: comp.lang.c Subject: space allocation for sprintf() Keywords: sprintf, space allocation Message-ID: <1991Jun5.174543.266@dg-rtp.dg.com> Date: 5 Jun 91 17:45:43 GMT Sender: usenet@dg-rtp.dg.com (Usenet Administration) Organization: Data General Corporation, RTP, NC. Lines: 23 Harbison & Steele p.328 contains the following parenthetical comment after a discussion of sprintf(): "(It is the programmer's responsibility to ensure that the destination string area is large enough to contain the output generated by the formatting operation.)" ["C: A Reference Manual," 2nd ed, Harbison & Steele, p.328] I have just a short question, two-part question: How do you know how much space to allocate? Or How do you know when you didn't allocate enough? My application has a varargs function which needs to eventually get to a single string to pass to routines which do NOT take a varargs interface. -Eric --------------------------------------------------------------------- Eric R Vook | Face reality as it is, Data General Corporation | not as it was vook@dg-rtp.dg.com | or as you wish it were. (Jack Welch)