Copy a file using POSIX API