Xref: utzoo comp.lang.c:17035 comp.sources.wanted:6754 comp.unix.wizards:15099 Path: utzoo!attcan!uunet!etnibsd!sean From: sean@etnibsd.UUCP (Sean McElroy) Newsgroups: comp.lang.c,comp.sources.wanted,comp.unix.wizards Subject: Re: How to predict size of outcome of vsprintf? Summary: One solution. Keywords: vsprintf formatted conversion Message-ID: <994@etnibsd.UUCP> Date: 17 Mar 89 19:42:52 GMT References: <993@etnibsd.UUCP> Reply-To: sean@etnibsd.UUCP (Sean McElroy) Distribution: na Organization: Eaton Ion Beam Systems Division, Beverly, MA Lines: 15 It turns out that vfprintf returns the number of characters transmitted to the file. If you use /dev/null as the file then it effectively returns the size of the output message string for vsprintf (less the terminator.) This solution has satisfied me for now although it's inefficient (and uses up a file descriptor). Perhaps there are others that I'm not aware of which don't have the same inefficiencies. I'm still interested in hearing about them. -- ____,.,_..,__.,_.,__ Sean Philip McElroy __'..__._,_.__.__.__ Eaton Corp., SED _,___`_.'__.__.__.__ 108 Cherry Hill Dr., Beverly, MA 01922 ___`..'_,___.__.__,_ uunet!etnibsd!sean