I'm looking to move a file from the directory of the current running application to another directory, but I can't seem to find a way of making it work. The code I have below was able to move the DLL I wanted, but it couldn't read the DLL properly, and it results in an error on injection (I don't get this error when I move it manually).
Also, if you have a solution in mind, i need one that can work without running as an admin.
current code:
std::ifstream src;
std::ofstream dst;
src.open("dll.dll", std::ios::in | std::ios::binary);
dst.open("C:\\subfolder \\dll.dll", std::ios::out | std::ios::binary);
dst << src.rdbuf();
src.close();
dst.close();
The best solution for me would be something like this:
CopyFile(L"dll.dll", L"C:\\subfolder\\newdll.dll", true);
But I don't know how to define the current directory.