If I use the new secure _tcscpy_s, should I do:
#define DESTLEN somenumber e.g. 10 or 255
void copystring(const _TCHAR* src_of_unknown_length)
{
_TCHAR msg[DESTLEN];
_tcscpy_s(msg, src_of_unknown_length, (size_t)DESTLEN);
// or _tcscpy_s(msg, src_of_unknown_length, (size_t)(DESTLEN - 1));
// ??
}
i.e. say if DESTLEN is 10, does it know to only copy 9 characters of
src_of_unknown_length into the buffer, in order to leave room for the null
terminator, or do I have to take this into account, as in the commented-out
bit?
And if so, is this behaviour different to that of the old _tcsncpy ?