Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to concatenate two LPCWSTR's in c++

I'm trying to use the MoveFile(LPCWSTR existing, LPCWSTR new) function. I'd like to be able the one of the directories (represented by LPCWSTR) by concatenating different data (for example: root directories and potential file names). Despite hours of research, I can't figure out how to do this. Appreciate any help.

like image 276
JHowzer Avatar asked May 11 '12 21:05

JHowzer


1 Answers

It sounds like you're trying to combine two LPCWSTR which represent paths elements into a combined paths. If that's the case then you want to use the PathCombine method

LPCWSTR root = ...;
LPCWSTR name = ...;
WCHAR combined[MAX_PATH];
if (PathCombineW(combined, root, name) != NULL) {
  // Succeeded
}
like image 134
JaredPar Avatar answered Oct 03 '22 23:10

JaredPar