Reputation: 56
I want to copy a single file, fairly large (+100MB) using CreateFile(), ReadFile(), and WriteFile().
My program successfully copied text file and other small file (in the range of KBs), but when I wanted to copy a 160 single .EXE file, it crashed and the debugger said "Stack overflow"
Upvotes: 0
Views: 655
Reputation: 49812
Don't read the whole file at once, read it in smaller chunks (up to a few megabytes) instead.
Windows has several file copy functions that are already quite flexible, e.g. CopyFileEx
, so consider using one of these functions instead.
Upvotes: 5