What is LPCSTR? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

What is LPCSTR?

velanrvelanr Posts: 13Member
I tried to find the meaning of this LPCSTR but it evades me. I know it is some sort of pointer? Any better explanation ? What is it used for ?
Any references on the web ?

Thank you.


Comments

  • weiccoweicco Posts: 950Member
    : I tried to find the meaning of this LPCSTR but it evades me. I know it is some sort of pointer? Any better explanation ? What is it used for ?
    : Any references on the web ?
    :
    : Thank you.
    :
    :
    :

    It basically const char *
  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : I tried to find the meaning of this LPCSTR but it evades me. I know it is some sort of pointer? Any better explanation ? What is it used for ?
    : Any references on the web ?
    :
    : Thank you.
    :
    :
    :
    LPCSTR is a remnant (Long Pointer to Constant STRing). 'Long' - because it is leftover from Win16 (Yeaahh! These old days in Win3.1...) The definition still exist, so old 16 bit code can be ported (compiled) successfully into Win32 world.

    Personally, I stopped using it about at 1997. The best way is to use TCHAR* and _T() macro to define the string constants. It will make your code portable to any Windows system, including international Windows: Corean, Japanese, etc.

  • Eric TetzEric Tetz Posts: 2,141Member
    : : I tried to find the meaning of this LPCSTR but it evades me. I know it is some sort of pointer? Any better explanation ? What is it used for ?
    : LPCSTR is a remnant (Long Pointer to Constant STRing). 'Long' - because it is leftover from Win16 (Yeaahh! These old days in Win3.1...) The definition still exist, so old 16 bit code can be ported (compiled) successfully into Win32 world.

    I still use it because LPCSTR is shorter than 'const char*' by 5 characters. ;)

    : Personally, I stopped using it about at 1997. The best way is to use TCHAR* and _T() macro to define the string constants. It will make your code portable to any Windows system, including international Windows: Corean, Japanese, etc.

    You can also use LPTSTR or LPCTSTR for 'TCHAR*' and 'const TCHAR*' respectively. Or if the "long pointer" business really bothers you, you can use:

    PSTR = char*
    PCSTR = const char*
    PTSTR = TCHAR*
    PCTSTR = const TCHAR*

    Cheers,
    Eric

    Cheers,
    Eric
  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : : : I tried to find the meaning of this LPCSTR but it evades me. I know it is some sort of pointer? Any better explanation ? What is it used for ?
    : : LPCSTR is a remnant (Long Pointer to Constant STRing). 'Long' - because it is leftover from Win16 (Yeaahh! These old days in Win3.1...) The definition still exist, so old 16 bit code can be ported (compiled) successfully into Win32 world.
    :
    : I still use it because LPCSTR is shorter than 'const char*' by 5 characters. ;)
    :
    : : Personally, I stopped using it about at 1997. The best way is to use TCHAR* and _T() macro to define the string constants. It will make your code portable to any Windows system, including international Windows: Corean, Japanese, etc.
    :
    : You can also use LPTSTR or LPCTSTR for 'TCHAR*' and 'const TCHAR*' respectively. Or if the "long pointer" business really bothers you, you can use:
    :
    : PSTR = char*
    : PCSTR = const char*
    : PTSTR = TCHAR*
    : PCTSTR = const TCHAR*
    :
    : Cheers,
    : Eric
    :
    : Cheers,
    : Eric
    :
    [blue]I guess, it is just a question of style. Personally, I like to see a '*' where a pointer is defined, so this LPTSTR is a little confusing to me.[/blue]

  • SebGarciaSebGarcia Posts: 1Member
    thanks! helped me a lot...

    Hope someone 8 years back to the past hears this =)
Sign In or Register to comment.