如何使用“strtok”在Visual Studio 2017中 [英] How use "strtok" in Visual Studio 2017
问题描述
尝试使用"strtok"时收到错误消息。 消息显示"此功能或变量可能不安全"。它建议使用"strtok_s" 。代替 我真的需要使用"strtok_s"吗? 或者可能
我包括错误的.h标题库? 我包括"string.h"和"stdio.h"。
I get an error message when trying to use "strtok". The message says "This function or variable may be unsafe" and it recommends to use "strtok_s" instead. Do I really need to use "strtok_s"? Or might I be including the wrong .h header library? I'm including "string.h" and "stdio.h".
推荐答案
尝试使用"strtok"时收到错误消息。 消息显示"此功能或变量可能不安全"。它建议使用"strtok_s" 。代替 我真的需要使用"strtok_s"吗? 或者可能
我包括错误的.h标题库? 我包括"string.h"和"stdio.h"。
I get an error message when trying to use "strtok". The message says "This function or variable may be unsafe" and it recommends to use "strtok_s" instead. Do I really need to use "strtok_s"? Or might I be including the wrong .h header library? I'm including "string.h" and "stdio.h".
如果你想使用" ;不安全"各种字符串函数的版本,您可以在包含任何头文件之前#define符号
_CRT_SECURE_NO_WARNINGS
。 请参阅
上的讨论
安全模板超载
If you want to use the "unsafe" versions of various string functions you can #define the symbol
_CRT_SECURE_NO_WARNINGS
before you include any header files. See the discussion at
Secure Template Overloads
这篇关于如何使用“strtok”在Visual Studio 2017中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!