Convert CString to LPCTSTR
-
hi, Can you plz tell me how to Convert CString to LPCTSTR. Thanks a lot.:rose:
-
hi, Can you plz tell me how to Convert CString to LPCTSTR. Thanks a lot.:rose:
-
hi, Can you plz tell me how to Convert CString to LPCTSTR. Thanks a lot.:rose:
-
-
thanks !!! :doh: i really can't understand people on the forum... i've been vote down one more time while i gave the answer... :((
TOXCCT >>> GEII power
[toxcct][VisualCalc]Well, if you are referring to your previous answer in this thread it could be the fact that the code you wrote will generate a compile time error. You're suggesting assigning a 'const char*' to a 'char'.;) On the other hand the answer should give the one asking the question the idea anyway, so I don't think it deserved to be rated '1'. I'll rate it up for you a little bit, if you want. :cool: -- Roger
-
Well, if you are referring to your previous answer in this thread it could be the fact that the code you wrote will generate a compile time error. You're suggesting assigning a 'const char*' to a 'char'.;) On the other hand the answer should give the one asking the question the idea anyway, so I don't think it deserved to be rated '1'. I'll rate it up for you a little bit, if you want. :cool: -- Roger
-
toxcct wrote: CString str = "Hello World"; char* pc; strcpy(pc, (LPCTSTR)str); While I understand the intent of your code, there are two things wrong with it. First is that no memory has been allocated to
pc
. Second, the cast instrcpy()
is not needed.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-
thank you very much, you're too good :D i corrected my wrong code, but i just wanted to show how to use the (LPCTSTR) cast operator...
TOXCCT >>> GEII power
[toxcct][VisualCalc] -
Not meaning to be picky, but that code won't work either as you're copying to a pointer that doesn't point to anything. But that's not the point. Your original "look at the other threads" comment was valid, which is why I voted it up earlier :]
icabod wrote: But that's not the point. Your original "look at the other threads" comment was valid, which is why I voted it up earlier :] visibly, not everyone understood that we were talking about the use of the (LPCTSTR) cast operator... I really don't see why i continue awering/helping people that don't take 1 minute of their time to see if their question is not already on the last 50 ones on the forum ... such behaviors sucks... (and i don't care to be voted down for this... :mad: )
TOXCCT >>> GEII power
[toxcct][VisualCalc] -
I am really sorry Mr. toxcct. Usually i search for article and i search in forum. But this time i didnot find anything in message search (LPCTSTR and LPCSTR string miss match). And its my mistake that i just overlooked the thread below. And i am happy that first reply of those threads posted by Rage helped me. Thanks and Sorry:rose: :)
-
I am really sorry Mr. toxcct. Usually i search for article and i search in forum. But this time i didnot find anything in message search (LPCTSTR and LPCSTR string miss match). And its my mistake that i just overlooked the thread below. And i am happy that first reply of those threads posted by Rage helped me. Thanks and Sorry:rose: :)