Jump to content
  • Advertisement
Sign in to follow this  
Florin Cazan

Problem with strings

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

if ( Materials.pTextureFilename != NULL ) { wchar_t strTexture[MAX_PATH]; StringCchCopyW( strTexture, MAX_PATH, L"Media\\" ); StringCchCatW( strTexture, MAX_PATH, (LPWSTR)Materials.pTextureFilename ); D3DXCreateTextureFromFileW( pd3dDevice, strTexture, &skyboxTex ); } This is the code where I load the mesh textures from the "Media" directory. The problem is that I get this error: D3DX: Media\: The system cannot find the file specified. even though the path is correct and the files are all there. I've tried this code in ANSI mode and it worked, so it appears that when I make the conversion to LPWSTR something goes wrong. (Note: The project uses Unicode character set) What could I do to resolve this?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
What could I do to resolve this?

Figure out what is wrong...

What type is Materials.pTextureFilename? Is it char* or wchar_t*? It most likely is char*, and you try to convert to wchar_t* by using a cast. The cast will just change the type, not the actual binary data of the string.

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!