Topic: sprintf return value


Author: mharriso@digi.lonestar.org (Mark Harrison)
Date: 26 Jan 93 20:21:58 GMT
Raw View
Will the C++ standard specify the return type of sprintf()?
--
Mark Harrison, mharriso@dsccc.com




Author: steve@taumet.com (Steve Clamage)
Date: Thu, 28 Jan 1993 19:07:59 GMT
Raw View
mharriso@digi.lonestar.org (Mark Harrison) writes:

>Will the C++ standard specify the return type of sprintf()?

Yes.  The C++ Standard will incorporate the library portion of the
ANSI/ISO C standard (with some minor modifications):

 int sprintf(char* buf, const char* fmt, ...);

It returns the number of characters stored in buf, like the rest of
the printf family.

Some C libraries have sprintf return buf (a char*), for reasons I
have never understood.  This is neither standard C nor standard C++.
--

Steve Clamage, TauMetric Corp, steve@taumet.com