Sign in to follow this  

Problem with strings

This topic is 4039 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[i].pTextureFilename != NULL ) { wchar_t strTexture[MAX_PATH]; StringCchCopyW( strTexture, MAX_PATH, L"Media\\" ); StringCchCatW( strTexture, MAX_PATH, (LPWSTR)Materials[i].pTextureFilename ); D3DXCreateTextureFromFileW( pd3dDevice, strTexture, &skyboxTex[i] ); } 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
Quote:
What could I do to resolve this?

Figure out what is wrong...

What type is Materials[i].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

This topic is 4039 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.

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