I have a question regarding coping of files:-
Is there any difference between Ancient Dragon's style of coping each byte at a time by looping through till EOF and azjherben's style of coping in one shot? I mean to ask about efficiency and all.
I think azjherben's would be faster and more efficient.
Need comments on this.
Thanks,
Copying everything in one shot is ok for small files that will easily fit in memory at one time. But will not work with huge files. I did not intend to suggest copying one byte at a time, but copying a buffer full, normally 255 bytes, at a time (depending on the sector size of the hard drive). Efficiency will depend on the operating system and how it handles buffered i/o. Some operating systems will not physically write to disk until its internal buffers are filled up. Similar with read requests -- the os might read a lot more data from the disk than requested in anticipation of another read request from the adjacent area (dick sector).