If you just want to copy files to where your executable is located, just specify no path whatsoever (or "." for the path). This uses the current directory, which will be the location of your executable unless you've gone and messed with a shortcut's working directory or something.
So, if you wanted to copy c:\file to the current directory, it's quite simple.
Code:
system("copy c:\file .");
Not that I'm recommending you use system(), but the idea is the same for opening your file manually.
Code:
copy_file("c:\file", ".\file");
where copy_file() is your own function.
[edit] Without error checking, using text functions:
Code:
bool copy_file(const char *fromname, const char *toname) {
std::ifstream from(fromname);
if(!from.is_open()) return false;
std::ofstream to(toname);
if(!to.is_open()) {
from.close();
return false;
}
unsigned char c;
while(from >> c) to << c;
// not strictly necessary
from.close();
to.close();
return true;
}
I think that would work, but I'm not sure. I could give you a C example, no problem. [/edit]