space allocation for sprintf()

Eric R Vook vook at narnia.rtp.dg.com
Thu Jun 6 03:45:43 AEST 1991


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 at dg-rtp.dg.com           |  or as you wish it were.  (Jack Welch)



More information about the Comp.lang.c mailing list