How can I copy a file from one directory to another in c/c++

前端 未结 7 421
闹比i
闹比i 2020-12-17 07:18

I am looking for a simple example on how to copy a file from one directory to another in C. The program should only use cross platform functions that are native to C.

7条回答
  •  情书的邮戳
    2020-12-17 07:46

    open source file read-only
    create destination file for write
    while there's still data in source file
        read data from source file
        write it to destination file
    close both files
    

    I'm sure you can do it!

提交回复
热议问题