Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!haven!adm!xadmx!rbj@dsys.icst.nbs.gov From: rbj@dsys.icst.nbs.gov (Root Boy Jim) Newsgroups: comp.unix.wizards Subject: How to predict size of outcome of vsprintf? Message-ID: <18847@adm.BRL.MIL> Date: 28 Mar 89 17:11:19 GMT Sender: news@adm.BRL.MIL Lines: 25 ? From: Sean McElroy ? O.K. Unix/C gurus, since vsprintf requires the user to ensure that there ? is enough space in the output string, how does one predict the size of ? the output string? Is there a routine which returns the predicted ? length of the output string (effectively preforming the printf conversions) ? without actually producing the output string? Allocate a buffer of BUFSIZ chars. If you overflow that, you are printing too much, and should go shoot yourself, most likely in the foot. However, if you are writing SDI code, ignore the preceding advice. ? Any suggestions welcome. Are you sure? ? ____,.,_..,__.,_.,__ Sean Philip McElroy ? __'..__._,_.__.__.__ Eaton Corp., SED ? _,___`_.'__.__.__.__ 108 Cherry Hill Dr., Beverly, MA 01922 ? ___`..'_,___.__.__,_ uunet!etnibsd!sean Catman Rshd Author of "The Daemonic Versions"