TCHAR* and LPTSTR
-
Does anybody know how to assign a TCHAR* fromo a LPTSTR. This is my code:
p->shi502_netname ="test"; LPTSTR h =p->shi502_netname ; TCHAR* var = h; cout< output: t when I try to print out h i get the first letter of string pointed to by h; I thing im no accessing the string from the pointer correctly Kelvin Cikomo
if you are using unicode build then you should use unicode set of apis to work on them. If you really need to work on multibyte string then you may have to use WideCharToMultiByte api to do the convertion.
-Prakash
-
I get wrong out puts if i try this. let me just give you part of my code
PSHARE_INFO_502 BufPtr,p; //SHARE_INFO_502 shInfo; //PSHARE_INFO_502 pShInfo = &shInfo; NET_API_STATUS res; LPTSTR lpszServer = NULL; DWORD er=0,tr=0,resume=0, i; //declare server variable lpszServer = lpszArgv[1]; cout<shi502_netname; cout<
as i can see from here, your real problem is probably not
cout<. I guess that cout statement is a debug output statement. if you want to fix that part, you have to use wcout and it will print properly. Is there any other problem in your code beside printing? * * * -Prakash