时间:2021-07-01 10:21:17 帮助过:11人阅读
snprintf用法
Header File
stdio.h
Category
Memory and String Manipulation Routines
Prototype
int snprintf(char* buffer, size_t nsize, const char* fmt, ...);
int snwprintf(wchar_t* buffer, size_t nsize, const wchar_t* fmt, ...);
Description
Sends formatted output to a buffer of a maximum length specified by nsize.
If the number of bytes to output is:
< nsize, then all of the characters have been written, including the terminating 慭0?character.
== nsize, then nsize characters are written, with no terminating 慭0?character.
> nsize, then only nsize characters are written, with no terminating 慭0?character.
If nsize is 0, then the string will not be written to (and may be NULL).
Return Value
Number of bytes output, or, if nsize is 0, the number of bytes needed, not including the terminating 慭0?character.