sprintf_s的使用

时间:2016-11-26 16:49:50   收藏:0   阅读:265

int sprintf_s(char *restrict buffer, rsize_t bufsz,
              const char *restrict format, ...);

 

sprintf_s原先只有windows的编译器才只支持,但是在C11之后,也加入了该函数。

Linux中有类似的函数实现,但是不完全相同,snprintf:

int snprintfchar *restrict buffer, int bufsz, 
              const char *restrict format, ... );

 

As all bounds-checked functions, printf_sfprintf_ssprintf_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>.

原文:http://www.cnblogs.com/dirt2/p/6104198.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!