Re: error when using wmemcpy
tmp[0] is a ptr to a constant, read-only string. You cant write to it. (and if you could, who guratnetess there`s enough free memory?).
If you want a writable buffer you have to explicitly reserve the amount of memory either
on the stack, locally (wchar path[MAC_PATH]), where MAX_PATH is the maximal length of the string.
or on the heap (new/delete).
Alternatively, you can use the std::string class for handling strings, which does memory management for you and allows for direct assigning of strings to each other.
Lastly, dont use size_t as a variable name, it`s a reserved keyword with most compilers.