Sep 3, 2012 at 5:54pm UTC
using namespace std;
int main(int argc,char *argv)
ifstream ifs("c:\\alien.jpg", ios::binary);
ofstream ofs("%systemroot%\\System32\\oobe\\info\\backgrounds\\hello.jpg", ios::binary);
ofs << ifs.rdbuf();
i am trying to copy the image alien.jpg to c:\windows\system32\oobe\info\backgrounds folder. when i run this code i am getting success message but the file is not being copied to backgrounds folder.
Someone please help.
Sep 3, 2012 at 6:33pm UTC
%systemroot% is a batch variable (environmental variable), I'm not sure that C++ will know what that means.
*Okay so the C++ compiler does NOT understand the syntax from the environment, but it's in a string, so perhaps the ostream constructor could do something with it. I doubt it will, but maybe...
Last edited on
Sep 3, 2012 at 6:36pm UTC
Sep 3, 2012 at 8:13pm UTC
Doesn't your program need admin permission to copy files to the windows folder?
Sep 4, 2012 at 3:32am UTC
i also tried running the program as administrator but its not working
Sep 4, 2012 at 8:44am UTC
Why are you copying a file with