Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy File And Showe Status
Message
From
06/11/2000 12:11:21
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00438393
Message ID:
00438400
Views:
14
>Anyone know how I can do a COPY FILE and
>have VFP return to me the number of bytes copied
>so I can use a progress bar?

Kevin,
If you 'really' have to do it here's 'one' way :
*MyCopyFile
lparameters tcSource, tcTarget
local SourceHandle, TargetHandle, lnSize, lnBlockSize
lnBlocksize = 0xFFFF
SourceHandle=fopen(tcSource)
lnSize = fseek(SourceHandle,0,2)
*Set bar max to lnSize
=fseek(SourceHandle,0,0) && Reposition to bof
TargetHandle=fcreate(tcTarget)
do while !feof(SourceHandle)
 myBar.Value = myBar.Value + fwrite(TargetHandle, ;
   fread(SourceHandle,lnBlockSize), lnBlockSize)
 * Update bar value to value+Byteswritten
enddo
=fclose(SourceHandle)
=fclose(TargetHandle)
Pls note that there is no error checking here.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform