I have seen a lot of type LPSTR(and other like LPCSTR, etc) when coding using MFC.

I just know it is equivalent to char*, but what LPSTR exactly is?
(ie, is it a native type in C++, or a macro in C++, or a typedef in C++, or...)

Recommended Answers

All 8 Replies

It's a typedef.

Yes, windows tend to do that for alot of types, and sometimes theres no need for them, for example in one of the header files I found these:

#define CONST               const
typedef int                 INT;
typedef float               FLOAT;

and hunderds more.. ;)

Yes, windows tend to do that for alot of types, and sometimes theres no need for them, for example in one of the header files I found these:

#define CONST               const
typedef int                 INT;
typedef float               FLOAT;

and hunderds more.. ;)

Hmm I wonder...

typedef void VOID

=P

Hmm I wonder...

typedef void VOID

=P

I'm pretty sure that exists too.

I also love this one (not sure if its in Windows API or DirectX):

#define 1 TRUE
#define 0 FALSE
typedef int BOOL;

It's just a way to make types sort of case-insensitive. It may be a bit superfluous at times, but it's a neat thing to have.

I'm pretty sure that exists too.

I also love this one (not sure if its in Windows API or DirectX):

#define 1 TRUE
#define 0 FALSE

Actually it would be

#define TRUE 1 
#define FALSE 0

the BOOL typedef'd as an int isn't actually so bad, it allows you to set your own returns values like:

#define FALSE		0
#define TRUE		1
#define OVERFLOW	2
#define FAIL		3
#define SUCCESS		4

any many more... :P

and can be more understood when returned as BOOL instead of int.

Actually it would be

#define TRUE 1 
#define FALSE 0

Oh ya. Got confused with the typedefs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.