Converting character array to LPCTSTR
-
Hi, Please anybody tell me how to convert a character array(char a[11]) to LPCTSTR??? Thank you Siddharth
-
Hi, Please anybody tell me how to convert a character array(char a[11]) to LPCTSTR??? Thank you Siddharth
Hi, What about:
LPCTSTR var1 = "Test"; char a[11]={0}; strcpy(a, var1); //or maybe this LPCTSTR var1; char a[11]="abcdefghijk"; strcpy(var1, a)
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's..... :) :)Programm3r My Blog: ^_^
-
Hi, Please anybody tell me how to convert a character array(char a[11]) to LPCTSTR??? Thank you Siddharth
if
_UNICODE
is NOT defined, then you can do a simple cast:LPCTSTR lp = (LPCTSTR) a;
however, if
_UNICODE
is defined, the you have to perform a conversion, using, for instance,MultiByteToWideChar
function [^]. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
Hi, What about:
LPCTSTR var1 = "Test"; char a[11]={0}; strcpy(a, var1); //or maybe this LPCTSTR var1; char a[11]="abcdefghijk"; strcpy(var1, a)
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's..... :) :)Programm3r My Blog: ^_^
-
you can't do that if
_UNICODE
is defined. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
CPallini wrote:
you can't do that if _UNICODE is defined
:doh::doh: Forgot about the
_UNICODE
... My bad :)
The only programmers that are better than C programmers are those who code in 1's and 0's..... :) :)Programm3r My Blog: ^_^