Visual Studio 2015。我正在阅读“Windows via C\C++”一书并尝试使用它的代码示例。作者写道,字符串的“安全”函数具有 _s
后缀,并在 StrSafe.h
header 中声明。此 header 将是包含列表中的最后一个。在我的代码中,我包含了这样的 header :
#include <iostream>
#include <exception>
#include <string>
#include <Windows.h>
#include <strsafe.h>
但是我有一个问题:
// IDE doesn't see the _tcscpy_s function
errno_t result = _tcscpy_s(szBuffer, _countof(szBuffer), TEXT("0123456789"));
我在 looked 中获取有关 _tcscpy_s
函数的信息,但我没有看到有关其头文件的信息(我预计它是 strsafe.h
)。
我该如何解决?
最佳答案
就像任何其他“通用文本”字符串函数版本一样,_tcscpy_s()
函数在 TCHAR.H
中声明(如 documentation 中所述)。
添加#include <tchar.h>
到你的代码。
关于c++ - 在哪个头文件中声明了函数 `_tcscpy_s`?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32883016/