• Advertisement
Sign in to follow this  

wcstombs unresponsive

This topic is 4468 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi: I am converting my std::wstrings to char*s like this: char* tempChar = NULL; const wchar_t* tempConstWide = g_IP.c_str(); wcstombs( tempChar, tempConstWide, 16 ); GetHost( tempChar, g_PORT ); where g_IP is a std::wstring, like "192.168.0.1" The const wchar_t* tempConstWide = g_IP.c_str(); line works, but tempChar remains a NULL pointer after the wcstombs function. I have included stdlib.h.... Any ideas why this might be? Thanks Si

Share this post


Link to post
Share on other sites
Advertisement
When you call wcstombs() you need to allocate room for the new string to go to; if you pass it a NULL nothing will happen.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement