How to read a binary file in c? (video, images, or text)

前端 未结 3 1627
慢半拍i
慢半拍i 2020-12-05 16:35

I am trying to copy a file from a specified library to the current directory. I can copy text files perfectly. Any other files become corrupt. The program detects a feof bef

3条回答
  •  星月不相逢
    2020-12-05 17:03

    You need to open the files in binary format rather than text format. In your calls to fopen, use "rb" and "wb" rather than "r" and "w" respectively.

提交回复
热议问题