   Concatenating two LPCWSTR
  Hey all,This is another general/DirectX question, heres what i want to do in semi-pseudocode:IDirect3DTexture9* tex = 0;LPCWSTR texFilename = CA2W(mtrls.pTextureFilename);LPCWSTR path = TEXT("MyFolder\\")LPCWSTR finalPath = 0;finalPath = path + TexFilename;    D3DXCreateTextureFromFile(Device,finalPath,&tex);I basically want to concatenate two LPCWSTR's so i can get to the texture resource in MyFolder but obviously i cant do this because they are two pointers, whats the best way to achieve this, im using a unicode build also.Thanks,Chett   
  Use std::wstring for both strings, then you can simply use operator+ to concatenate. When you need to pass the LPCWSTR to API methods, use the c_str() method of std::wstring.   ;  There is also the StringCchCat() function from strsafe.h   ;  Old-school 'C' style would be to call wcslen on both strings, malloc a new buffer big enough to hold the concatentation (don't forget the NULL terminator and to handle the difference between byte and character lengths), wcscpy the first string to the new buffer, wcscat the second string (you also can use the StringCch stuff if you really want to), do whatever, then try to remember to free the buffer afterwords.Or you can do C++ style and use wstring instead as jpetrie suggested and everything works with basically no effort.Don't use the TEXT macro if you are using LPCWSTR.  Just use L"MyFolder\\".  You only use TEXT if you are also using LPCTSTR.  IMHO there isn't really much point in using the 'T' stuff anymore.  Just using Unicode and be done with it.   ;  Cool thanks, i also need to do float to LPCWSTR. Is there an easy way to do this also?   ;Quote:Original post by Chett2001Cool thanks, i also need to do float to LPCWSTR. Is there an easy way to do this also?Again, convert to std::wstring first, via a std::wstringstream.   