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 8350905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:27:52+00:00 2026-06-09T08:27:52+00:00

I need to convert character pointer to a w_char * in order to use

  • 0

I need to convert character pointer to a w_char * in order to use ParseNetworkString(). I’ve tried finding solutions to this myself, and while I have found one solution, there is one issue which blocks me from using it:

b1naryatr0phy said in an other post:

std::wstring name( L"Steve Nash" );
const wchar_t* szName = name.c_str();

this almost works for me, except that I can’t just pass the string explicity, as its value is not always going to be the same, meaning I can’t just put it in quotes. If I replace the parameter with a function call, then the first line gives me an error (example: std::wstring name(LgetIpAddress()); I’ve tried std::wstring name(L” ” + getIpAddress() + ” “); , thinking that it just needs a quotation mark after the L, but that doesn’t work either.. any suggestions?

Thanks! 🙂

Extra Kudos to whoever can answer this!

link to other post: I want to convert std::string into a const wchar_t *

P.S. Sorry, just to clarify, getIpAddress returns a character pointer

  • 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-09T08:27:54+00:00Added an answer on June 9, 2026 at 8:27 am

    What’s the type of getIpAddress()?

    Here’s a snippet showing how to convert a string to a wstring (using standard C++11, no error checking):

    wstring to_wstring(string const& str)
    {
      size_t len = mbstowcs(nullptr, &str[0], 0);
      if (len == -1) // invalid source str, throw
      wstring wstr(len, 0);
      mbstowcs(&wstr[0], &str[0], wstr.size());
      return wstr;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to convert %F3%BE%AE%A2 to this char in PHP. When I tried using
I have a need to convert one string to another string (4 character always)
How do you convert a character array to a String? I have this code
I have the following string \u5733. I need to convert this to its respective
I need to convert an integer into a base64-character representation. I'm using OxA3's answer
I need to convert arabic characters to its hex code as in character map,
I have a field varchar(14) = 20090226115644 I need convert it to -> 2009-02-26
$ch is a character. I need to convert it into 2 numbers like that
hi to set my applications hotkeys i need to convert a character into its
I need to convert very large text files (usually over 100 MB) of character

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.