Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

183
Visualizações
What is Linux equivalent of LPTSTR & LPCSTR?

I am converting windows library to linux. I need to find LPTSTR and LPCSTR in linux.

I get to know that i can use wchar_t can be used but I am not really sure about using it.

one of the method that uses LPTSTR is as follows:

void ErrorExit(LPTSTR zFunction)
{
}

Any help will be appreciated!

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

In Linux you don't usually use wchar_t for library API functions. Most libraries use UTF-8 encoded strings, so they take as strings plain arrays of NUL-terminated chars (IMO that is far better than duplicating all the functions with ANSI and Unicode versions).

So, with that in mind:

  • LPCTSTR, LPCSTR, LPCWSTR -> const char *.
  • LPTSTR, LPSTR, LPWSTR -> char *.

If you insist in using Unicode functions, MS style, you have to be aware that they actually use UTF-16 encoded strings, and wchar_t is not a portable type, as its size is not specified by the language. Instead you can use uint16_t:

  • LPCWSTR -> const uint16_t *.
  • LPWSTR -> uint16_t *.

And if you want to be extra MS compatible, you can use the UNICODE macro to conditionally typedef the LPTSTR and LPTCSTR into one of the others, but that's probably unneeded for your problem.

over 4 years ago · Santiago Trujillo Relatório

0

LPTSTR - L‌ong P‌ointer to T‌CHAR STR‌ing (Don't worry, a long pointer is the same as a pointer.)

LPCSTR - L‌ong P‌ointer to a C‌onst STR‌ing

LPSTR = char*
LPCSTR = const char*
LPWSTR = wchar_t*
LPCWSTR = const wchar_t*
LPTSTR = char* or wchar_t* depending on _UNICODE
LPCTSTR = const char* or const wchar_t* depending on _UNICODE

from msn page LPCSTR

typedef const char* LPCSTR;

from msn page LPTSTR=>

#ifdef UNICODE
 typedef LPWSTR LPTSTR;
#else
 typedef LPSTR LPTSTR;
#endif
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda