Jump to content
  • Advertisement
Sign in to follow this  
jagguy2

unicode and strings

This topic is 3907 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

D3DXCreateTextureFromFile( g_pd3dDevice, mtrls.pTextureFilename, //error cannot convert parameter 2 from 'LPSTR' to 'LPCWSTR' &tex); I tried wchar_t str[20],*str2; str2="L"+mtrls.pTextureFilename; How can i change the filename to unicode?

Share this post


Link to post
Share on other sites
Advertisement
The simplest solution is (in VC++ 2005 express) - go to Project -> Properties -> Configuration Properties -> General -> Character Set, and choose "Use Multi-byte Character Set". Then you won't have to bother with unicode.

Share this post


Link to post
Share on other sites
You'll want to look at wcstombs() and mbstowcs() which convert between multi-byte strings and wide character strings.

Share this post


Link to post
Share on other sites



wcstombs(mtrls.pTextureFilename,str,20);
D3DXCreateTextureFromFile( g_pd3dDevice, str, &tex); //compiles but is this it? i get an x File with no materials so i dont know if this is correct



this is in a loop so is this a problem

const size_t length = 1 + strlen(mtrls.pTextureFilename);
LPWSTR wcsText = new WCHAR[length];
mbstowcs(wcsText, mtrls.pTextureFilename, length);

[Edited by - jagguy2 on January 12, 2008 6:26:51 AM]

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!