Copy a file in a sane, safe and efficient way

前端 未结 7 1386
小蘑菇
小蘑菇 2020-11-22 07:11

I search for a good way to copy a file (binary or text). I\'ve written several samples, everyone works. But I want hear the opinion of seasoned programmers.

I missin

7条回答
  •  醉酒成梦
    2020-11-22 07:29

    Qt has a method for copying files:

    #include 
    QFile::copy("originalFile.example","copiedFile.example");
    

    Note that to use this you have to install Qt (instructions here) and include it in your project (if you're using Windows and you're not an administrator, you can download Qt here instead). Also see this answer.

提交回复
热议问题