4 ms·
In this simple case, if the int cast is a problem, fwrite would be an adequate alternative, don’t you think?
by jrpelkonen 3y ago
In this simple case, if the int cast is a problem, fwrite would be an adequate alternative, don’t you think?
- PaulDavisThe1st 3y agonot for s(n)printf ...
- LegionMammal978 3y agoFor that, the analogue would be memcpy; but both alternatives lose the ease of surrounding the string with other text, since you either have to do the length calculations or define helper functions.
- eqvinox 3y agoThe point of this is that you can use it in format strings where you may be printing a whole bunch of other things. In particular there are some APIs where you need to submit the whole format/string in one go, an example from libc is syslog(), but other libraries do this as well occasionally.