vs出现snprintf问题

snprintf()函数的格式跟printf差不多一样,是在c里面用的函数,包含在 #include <stdio.h>头文件中。

但snprintf()函数并不是标准c/c++中规定的函数,所以在许多编译器中,厂商提供了其相应的实现的版本。在gcc中,该函数名称就snprintf(),而在VS中称为_snprintf。 所以在需要使用snprintf()时改成_snprintf就可以了,或则在预编译处加入:

#if _MSC_VER

#define snprintf _snprintf

#endif

猜你喜欢

转载自blog.csdn.net/Touch_Dream/article/details/81633685