File Copy Routines - aka FCOPY()
Posted: Wed Nov 19, 2008 4:33 pm
At present I am writing am application in HMG to copy files from one location to another on our network. The actual copy section is
This works fine if the file is not in use. I use the ferase() function to remove the old file and to determine if I can copy or not. If the file is in use then it cannot be erased and so the copy would be flagged as failed.
If I remove the ferase() call and try and run it I get a DOS error 32 - Sharing Violation if the file is in use.
I seem to remember from my clipper days a function called FCOPY() that was in some of the TP Libraries. It would overwrite the file, even if it was open. Does anyone know of an equivalent function(s) in Harbour/HMG that I could use to do the copy? I have been unable to track one down in the documentation.
Could I use FCREATE()/FREAD()/FCLOSE() etc?
Any suggestions/assistance will be much appreciated.
Thanks.
Regards
McMint.
(An Englishman living in Scotland - and loving it! )
Code: Select all
static function DoCopy(cName,cOut,lSuccess)
// set lSuccess to failed
lSuccess:=.f.
if (ferase((cOut)) == 0)
copy file &cName to &cOut
lSuccess := .t.
endif
return lSuccess
If I remove the ferase() call and try and run it I get a DOS error 32 - Sharing Violation if the file is in use.
I seem to remember from my clipper days a function called FCOPY() that was in some of the TP Libraries. It would overwrite the file, even if it was open. Does anyone know of an equivalent function(s) in Harbour/HMG that I could use to do the copy? I have been unable to track one down in the documentation.
Could I use FCREATE()/FREAD()/FCLOSE() etc?
Any suggestions/assistance will be much appreciated.
Thanks.
Regards
McMint.
(An Englishman living in Scotland - and loving it! )