convert LPTSTR to string

16,292

LPTSTR is a string, it's just not constant.

You can use it like a regular char * if as long as you don't define UNICODE in your application. The difference between a unicode and normal string is the length of the character. In unicode it is either 2 or 4 and in standard programs it is 1 byte.

As some people might point out, you're not the only one to ask this question. This is usually a topic of confusion for people learning to program in the Windows environment. See this for some clarification, from MSDN. I'd also recommend viewing their desktop API reference for a lot of useful information that may help you with future inquiries.

Share:
16,292
user2407956
Author by

user2407956

Updated on June 04, 2022

Comments

  • user2407956
    user2407956 almost 2 years

    I am getting text from a Window and it returns in LPTSTR. I have to turn it into string or else I have to rewrite a lot of my code. Also What is a LPTSTR and how is it different from a string?