Reputation: 12516
Visual Studio 2015. I am reading the "Windows via C\C++" book and try to use its code samples. Author writes that the "safe" functions of string have the _s
suffix and are declared in the StrSafe.h
header. This header are to be the last in the list of includes. In my code I included such headers:
#include <iostream>
#include <exception>
#include <string>
#include <Windows.h>
#include <strsafe.h>
But I have a problem:
// IDE doesn't see the _tcscpy_s function
errno_t result = _tcscpy_s(szBuffer, _countof(szBuffer), TEXT("0123456789"));
I looked for info about the _tcscpy_s
function, but I didn't see info about its header file (I expected that it is strsafe.h
).
How can I fix it?
Upvotes: 0
Views: 5875
Reputation: 46341
Just like any other "Generic Text" string function version, the _tcscpy_s()
function is declared in TCHAR.H
(as mentioned in the documentation).
Add #include <tchar.h>
to your code.
Upvotes: 6