天天看點

用WindowsAPI實作檔案複制功能

用WindowsAPI實作檔案複制功能

注釋也在裡面

檔案名為 copyfile.c 運作出來的exe為 copyfile.exe

我此時的檔案存在情況 隻有1.txt 和 2.txt

用WindowsAPI實作檔案複制功能
用WindowsAPI實作檔案複制功能

檢視兩個檔案

首先我要設定2.txt為隻讀 這樣就會觸發第二個錯誤

用WindowsAPI實作檔案複制功能

結果

用WindowsAPI實作檔案複制功能