[英]In what header file the function `_tcscpy_s` is declared?
Visual Studio2015。我正在阅读《 通过C \\ C ++的Windows 》一书,并尝试使用其代码示例。 作者写道,字符串的“安全”功能具有_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
)。
我该如何解决?
就像任何其他“通用文本”字符串函数版本一样, _tcscpy_s()
函数在TCHAR.H
声明(如文档中所述)。
将#include <tchar.h>
添加到您的代码中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.