int sprintf_s(char *restrict buffer, rsize_t bufsz,
const char *restrict format, ...);
sprintf_s原先只有windows的编译器才只支持,但是在C11之后,也加入了该函数。
Linux中有类似的函数实现,但是不完全相同,snprintf:
int snprintf( char *restrict buffer, int bufsz,
const char *restrict format, ... );
As all bounds-checked functions, printf_s
, fprintf_s
, sprintf_s
, and snrintf_s
are only guaranteed to be available if __STDC_LIB_EXT1__ is defined by the implementation
and if the user defines __STDC_WANT_LIB_EXT1__ to the integer constant 1 before including <stdio.h>
.
时间: 2024-12-15 09:21:07