i dont know but when i try to use _tcslen i get an error saying undefined function.
which header file i should include for _tcslen iam making a win32 app.
Regards.
Printable View
i dont know but when i try to use _tcslen i get an error saying undefined function.
which header file i should include for _tcslen iam making a win32 app.
Regards.
#include <string.h>
Cheers
In fact _tcslen is a macro defined in TCHAR.H.
It expands to wcslen or strlen if _UNICODE preprocessor constant is defined or not.
wcslen and strlen functions are indeed declared in STRING.H.
Hi!
Very sorry for the late reply as i was not able to connect.
Thanks ovidiucucu :).
I dont know but i ve been running into strange problems. When ever i try using sprintf the app crashes, here is what i ve been doing:
The app also crahes when i use strcat, why is all this happening?Code:LPTSTR pszMessage = NULL;
sprintf (pszMessage, "Hi!");
Regards.
of course it will crash :-) LPTSTR is unallocated pointer and you are trying to ::sprintf to him!Quote:
Originally Posted by logan
you have 2 options
1)
decalre TCHAR pszMessage[128]; // you will chose the size you want.
2)
LPTSTR pszMessage = new TCHAR[size you want];
after that you can do whatever you want.
if i helped dont forget to rate :-)
Cheers
Also, if your going to use _tcslen() and TCHAR in order to be Unicode-safe, you'll probably want to use _stprintf() instead of sprintf() and _tcscat() instead of strcat().