Solved

LPTSTR

Posted on 2004-10-02
4
3,022 Views
Last Modified: 2008-01-09
hi, could someone please explain - LPTSTR.
why,

 LPTSTR ptr;

and not...

 LPTSTR *ptr

a full explanation on  LPTSTR and how to
use it  would be greatly apriciated.

thanks..
0
Comment
Question by:mikem_2au
  • 3
4 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12209944
LPTSTR is a pointer type, a pointer to a string, or an array of TCHAR to be precise.
Depending of implementation, it can point to a ANSI or Unicode string.

You must not use LPTSTR * because it is a pointer itself:

typedef TCHAR * LPCTSTR;


0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 250 total points
ID: 12209954
Sorry, there is a typo:

LPTSTR is equivalent in fact to:
typedef TCHAR *LPTSTR;

And LPCTSTR (constant pointer) is equivalent to:
typedef const TCHAR * LPCTSTR;
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12210039
Some complementary information here:
http://www.codetools.com/string/tconvert.asp
0
 

Author Comment

by:mikem_2au
ID: 12210247
thankyou for clearing that up for me.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now