How can I copy a file on Unix using C?

前端 未结 8 711
说谎
说谎 2020-11-27 12:39

I\'m looking for the Unix equivalent of Win32\'s CopyFile, I don\'t want to reinvent the wheel by writing my own version.

8条回答
  •  孤独总比滥情好
    2020-11-27 12:44

    One option is that you could use system() to execute cp. This just re-uses the cp(1) command to do the work. If you only need to make another link to the file, this can be done with link() or symlink().

提交回复
热议问题