C++ FileIO Copy -VS- System("cp file1.x file2.x)

前端 未结 5 1958
自闭症患者
自闭症患者 2021-01-31 22:15

Would it be quicker/efficient to write a file copy routine or should I just execute a System call to cp?

(The file system could differ [nfs, local, reiser, etc], however

5条回答
  •  执念已碎
    2021-01-31 22:56

    With your own routine you can control the size of the block used for copying, which you can't do with cp. Also, you can spawn different threads for reading and writing data (to further speed up process). Finally, spawning an external process takes extra time (important if you copy small files).

提交回复
热议问题