Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!hacgate!ashtate!dbase!awd From: awd@dbase.A-T.COM (Alastair Dallas) Newsgroups: comp.windows.ms.programmer Subject: Re: copying files within windows Message-ID: <1991Mar21.183548.15281@dbase.A-T.COM> Date: 21 Mar 91 18:35:48 GMT References: <1157@bjcong.bj.co.uk> Organization: Ashton-Tate, Inc. Lines: 36 In article <1157@bjcong.bj.co.uk>, rkt@bjcong.bj.co.uk (RAKESH TANDON) writes: > I'm about to write a windows installation program and would like > to know the best way of copying files from floppy disk to hard disk. The best way is to allocate as large a buffer as you can, and: /* software wheel #319 */ while (filsiz > 0) { this = MIN(filsiz, bufsiz); read( 'this' many bytes ); write( 'this' many bytes ); filsiz -= this; } 'This' will be bufsiz until the last time. 'Bufsiz' should be a multiple of 512. You can get very fancy and request device parameters for the disk(s) you're dealing with. Ideally, you'd like to read and write whole cylinders at a time, but it's not an ideal world--you might spend so long thinking about it that you delay the overall performance. Bufsiz's of 16k, 32k or 48k copy files very nicely. Note that this basic loop can handle splitting large files across several floppies-- just don't close the output file. As an alternative, you could WinExec command.com and 'copy', which is a highly optimized command. Or, you could do your installation as a .bat file the way a lot of people do :-). Hope it helps. /alastair/ -- |Disclaimer: I am speaking for myself, not as a spokesman for Ashton-Tate, |which does not monitor my outbursts here. I reserve all rights to my |opinions in terms of commercial endorsements.