About LPSTR

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2008
Posts: 11
Reputation: jack1234 is an unknown quantity at this point 
Solved Threads: 0
jack1234 jack1234 is offline Offline
Newbie Poster

About LPSTR

 
0
  #1
Jul 14th, 2008
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...)
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,858
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 755
Team Colleague
Narue's Avatar
Narue Narue is online now Online
Senior Bitch

Re: About LPSTR

 
1
  #2
Jul 14th, 2008
It's a typedef.
New members chased away this month: 5
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,495
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 123
Sponsor
William Hemsworth William Hemsworth is online now Online
Nearly a Posting Virtuoso

Re: About LPSTR

 
0
  #3
Jul 14th, 2008
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:
  1. #define CONST const
  2. typedef int INT;
  3. typedef float FLOAT;
and hunderds more..
I need pageviews! most fun profile ever :)
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 973
Reputation: Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough 
Solved Threads: 107
Alex Edwards's Avatar
Alex Edwards Alex Edwards is offline Offline
Posting Shark

Re: About LPSTR

 
0
  #4
Jul 14th, 2008
Originally Posted by williamhemswort View Post
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:
  1. #define CONST const
  2. typedef int INT;
  3. typedef float FLOAT;
and hunderds more..
Hmm I wonder...

  1.  
  2. typedef void VOID

=P
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 401
Reputation: CoolGamer48 is on a distinguished road 
Solved Threads: 40
CoolGamer48's Avatar
CoolGamer48 CoolGamer48 is offline Offline
Posting Pro in Training

Re: About LPSTR

 
0
  #5
Jul 14th, 2008
Originally Posted by Alex Edwards View Post
Hmm I wonder...

  1.  
  2. 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):
  1. #define 1 TRUE
  2. #define 0 FALSE
  3. 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 a student. If my statements seem too absolute, feel free to coat them with "In my opinion..." or "I believe...".
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 980
Reputation: mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice 
Solved Threads: 210
mitrmkar mitrmkar is offline Offline
Posting Shark

Re: About LPSTR

 
0
  #6
Jul 14th, 2008
Originally Posted by CoolGamer48 View Post
I'm pretty sure that exists too.

I also love this one (not sure if its in Windows API or DirectX):
  1. #define 1 TRUE
  2. #define 0 FALSE
Actually it would be

  1. #define TRUE 1
  2. #define FALSE 0
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,495
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 123
Sponsor
William Hemsworth William Hemsworth is online now Online
Nearly a Posting Virtuoso

Re: About LPSTR

 
0
  #7
Jul 14th, 2008
the BOOL typedef'd as an int isn't actually so bad, it allows you to set your own returns values like:
  1. #define FALSE 0
  2. #define TRUE 1
  3. #define OVERFLOW 2
  4. #define FAIL 3
  5. #define SUCCESS 4
any many more...

and can be more understood when returned as BOOL instead of int.
I need pageviews! most fun profile ever :)
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: About LPSTR

 
1
  #8
Jul 14th, 2008
These typedefs and macros were created by MS team in early Windows era in the interests of portability.
See brief summary and historical introduction:
http://en.wikibooks.org/wiki/Windows...and_Data_Types
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 401
Reputation: CoolGamer48 is on a distinguished road 
Solved Threads: 40
CoolGamer48's Avatar
CoolGamer48 CoolGamer48 is offline Offline
Posting Pro in Training

Re: About LPSTR

 
0
  #9
Jul 14th, 2008
Originally Posted by mitrmkar View Post
Actually it would be

  1. #define TRUE 1
  2. #define FALSE 0
Oh ya. Got confused with the typedefs.
I'm a student. If my statements seem too absolute, feel free to coat them with "In my opinion..." or "I believe...".
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 5815 | Replies: 8
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC