Article View: borland.public.cppbuilder.nativeapi
Article #16405File Copy Operation
From: Muhammad Momin Rashid
Date: Thu, 15 May 2003 09:28
Date: Thu, 15 May 2003 09:28
37 lines
2323 bytes
2323 bytes
Hello All, <Brief Description and background> I made a program some time back for copying large files from one media to another. I am using TFileStream Object to read and write chunks of data from an existing file to a new file (I am reading writing chunks of data because in some cases I need to modify data before writing it to new file). <Problem> 1. This approach is significantly slower than the windows file copy operation itself. I need to speed up my file coping operation. 2. The operation consumes a lot of processing power while reading from media such as CDROM etc. Is there any way to bring down the processor usage? 3. If there is a problem in file reading (bad or corrupted media) the system locks up for a fair amount of time. How to avoid this? and how can I control the amount of time system has to keep trying before it quits trying to read? <Sample Code> fsPtrExistingFile = new TFileStream(EditFileToCopy->Text, fmOpenRead | fmShareDenyWrite); fsPtrNewFile = new TFileStream(EditCopyTo->Text + asFileName, fmCreate | fmShareDenyWrite); // Some code here // Loop till end of file is reached fsPtrExistingFile->Read(cPtrBuffer, lMaxBufferSize); fsPtrNewFile->Write(cPtrBuffer, lMaxBufferSize); // Clean up code here Thanks for your time and effort Muhammad Momin Rashid
Technical Details
Message-ID:
<3ec35dd4@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!newsfeed.bc.tac.net!cyclone.bc.net!logbridge.uoregon.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,2c3eb0c8d9515a68,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-05-15 02:32:03 PST From: "Muhammad Momin Rashid" <momin@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: File Copy Operation Date: Thu, 15 May 2003 14:28:50 +0500 Lines: 39 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 202.163.125.162 Message-ID: <3ec35dd4@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1052990932 202.163.125.162 (15 May 2003 02:28:52 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!newsfeed.bc.tac.net!cyclone.bc.net!logbridge.uoregon.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail