Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8994591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:28:01+00:00 2026-06-15T23:28:01+00:00

Im trying to convert arguments LPWSTR to LPTSTR, it there any library I can

  • 0

Im trying to convert arguments LPWSTR to LPTSTR, it there any library I can user for easy string convertion?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:28:02+00:00Added an answer on June 15, 2026 at 11:28 pm

    If _UNICODE is defined there’s no conversion to do – a TCHAR is a WCHAR, and LPWSTR is LPTSTR; otherwise, TCHAR is a CHAR, and LPTSTR is LPSTR. In this last case, you can use the WideCharToMultiByte API to convert a LPWSTR (i.e. a Unicode string) to a “narrow” string.

    Also, you can use the wcstombs C library function, assuming that the Windows types CHAR and WCHAR map to the C types char and wchar_t (which is surely the case in VC++), and that the current C locale is the one you intend to use for the conversion.


    See also Alf‘s comments for more insight on the matter – the most important point being that if you can you should avoid such conversion, since your output encoding in general cannot represent faithfully the input, and, depending from what your string represents this may mean garbled text as well as not finding the required file or, even worse, operating on the wrong path.

    So, set your project to use Unicode (as in @prazuber‘s answer) and always try to use Unicode-aware APIs, so to avoid this kind of conversion.

    Still, keep in mind that using only the Unicode version of the Windows APIs may mean losing compatibility with Windows 9x; this is not a problem for the vast majority of cases, but if it’s critical to support such OSes in your application check if the APIs you are using are supported in MSLU.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to convert a string of binary inputs into a vector of ints. I'd
Trying to convert the following but am having difficulty. Can anyone see where I'm
Trying to convert int arrays to string arrays in numpy In [66]: a=array([0,33,4444522]) In
I'm trying to use partial application of function arguments so I can use STL's
Can someone help me to convert an NSObject to NSString? I'm trying to do
Am trying to convert my string value(the value is millisecond value) from seconds. Here
I'm trying to convert the hexadecimal representation of a 64-bit number (e.g., the string
In the formula below I'm trying to convert a custom date string (yyyymmddhhmmss) into
How can I convert a datetime object to the format yyyy/MM/dd? I am trying
I am trying to convert a double to a string on the stack from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.