没有看明白的微软 UCRT 文档
没有看明白的微软 UCRT 文档
Beginning with the UCRT in Visual Studio 2015 and Windows 10, snprintf
is no longer identical to _snprintf
. The snprintf
behavior is now C99 standard conformant. The difference is that if you run out of buffer, snprintf
null-terminates the end of the buffer and returns the number of characters that would have been required whereas _snprintf
doesn’t null-terminate the buffer and returns -1. Also, snprintf()
(这里的 snprintf()
是不是写错了,应该是 _snprintf()
吧?) includes one more character in the output because it doesn’t null-terminate the buffer.
参考网址: snprintf, _snprintf, _snprintf_l, _snwprintf, _snwprintf_l