What does sprintf stand for?

I tried looking it up on google and wikipedia but couldn't find an answer... Does anyone know what 'sprintf' or 'printf' stands for? Is it an abbreviation for something???

Thanks


String PRINT Format(ed).

Ie print to string using a given format.


The various members of the printf family, derived from C where they first appeared (though they hark back to the olden days of BCPL's writef call along that particular lineage), include:

printf    - print formatted (to standard output).
fprintf   - file printf (to a file handle).
sprintf   - string printf (to a string).
snprintf  - sprintf with added overflow protection.

In addition, there are variants of those starting with v (as in vsnprintf ) which can take variable arguments like printf itself.

By that I mean that they pass around a varargs argument rather than a series of arguments, allowing you to write your own printf -like function. I've used this before when developing logging libraries in the past.


sprintf originates from C. Refer to eg

http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/

where it says:

Writes into the array pointed by str a C string ...

thus: s(tring)printf(ormatted)

链接地址: http://www.djcxy.com/p/58880.html

上一篇: 从Laravel执行HTTP请求到外部API

下一篇: sprintf代表什么?