It would not be time efficient to write a file copy routine.
It is resource intensive to call system to shell a cp.
You'll be far better served by figuring out the system (function) call that you can make to copy the file. E.g. on Windows it's just CopyFile(src, dst) if I recall correctly.