home *** CD-ROM | disk | FTP | other *** search
- *******************
-
- FUNCTION Copyfile
-
- PARAMETERS _afile, _bfile
-
- IF PCOUNT() != 2
- RETURN(.F.)
- ELSEIF TYPE("_afile")+TYPE("_bfile") != "CC"
- RETURN(.F.)
- ELSE
- _afile = LTRIM(TRIM(_afile))
- _bfile = LTRIM(TRIM(_bfile))
- IF !FILE(_afile)
- RETURN(.F.)
- ENDIF
- ENDIF
-
- PRIVATE _ahandle, _bhandle, _read, _chars
-
- _ahandle = FOPEN(_afile)
- _bhandle = FCREATE(_bfile)
-
- DO WHILE (FERROR() = 0)
- _read = SPACE(4000)
- _chars = FREAD(_ahandle, @_read, 4000)
- FWRITE(_bhandle, _read, _chars)
- IF _chars != 4000 && End of File
- EXIT
- ENDIF
- ENDDO
-
- FCLOSE(_ahandle)
- FCLOSE(_bhandle)
-
- RELEASE _read, _chars, _ahandle, _bhandle
-
- RETURN( (FERROR() != 0) )
-
- * End of File
-