Problem with strings
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?
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement