Visual Studio 2015。我正在阅读"通过C\C++窗口“一书,并尝试使用它的代码示例。作者写道,字符串的“安全”函数具有_s后缀,并在StrSafe.h头中声明。此标题将是包含列表中的最后一个标题。在我的代码中,我包括了这样的标题:
#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"));我看上去获取关于_tcscpy_s函数的信息,但是我没有看到关于它的头文件的信息(我希望它是strsafe.h)。
我怎么才能修好它?
发布于 2015-10-01 08:40:15
与任何其他“泛型文本”字符串函数版本一样,_tcscpy_s()函数是在TCHAR.H (如文档中提到的)中声明的。
将#include <tchar.h>添加到代码中。
https://stackoverflow.com/questions/32883016
复制相似问题