Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copy File And Showe Status
Message
De
06/11/2000 12:11:21
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00438393
Message ID:
00438400
Vues:
15
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform