I was wondering which is the correct way?
_tcscpy(tchar_pointer, _tcslen(tchar_pointer), _T("Hello World"));
or
_tcscpy(tchar_pointer, _tcsclen(tchar_pointer), _T("Hello World"));
or
_tcscpy(tchar_pointer, ???, _T("Hello World"));
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If this is so, then none of these do what you want.
The way all the “safe” functions work is that you tell them how big the target buffer is.
You don’t know? You can’t use those functions.
This will not work. All it will guarantee is that the string copied is not longer than whatever is already in the buffer. If the buffer has not been initialized, it will fail; if the buffer begins with a
'\0', nothing will be copied; and so forth.