How to combine two LPCWSTR in C ++

I am trying to use the new MoveFile function (LPCWSTR, new LPCWSTR). I would like to be able to use one of the directories (represented by LPCWSTR), combining different data (for example: root directories and potential file names). Despite hours of research, I cannot figure out how to do this. Appreciate any help.

+6
source share
2 answers

It looks like you are trying to combine two LPCWSTR that represent path elements in combined paths. If in this case you want to use the PathCombine method

 LPCWSTR root = ...; LPCWSTR name = ...; WCHAR combined[MAX_PATH]; if (PathCombineW(combined, root, name) != NULL) { // Succeeded } 
+10
source

You should use _wmakepath_s() to compose a wide char path.

0
source

Source: https://habr.com/ru/post/915540/


All Articles