Sign in to follow this  
sipickles

wcstombs unresponsive

Recommended Posts

sipickles    240
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
SiCrane    11839
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this