simple file copy implemented in C