home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 24.4 Ucopy()
- Author: Joe Booth
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
- */
-
- #include "FILEIO.CH"
- #define BUFSIZE 2048
-
- function Ucopy(old_file,new_file)
- LOCAL in_handle,out_handle,buffer:=space(BUFSIZE),nbytes
- in_handle := Fopen(old_file,FO_READ)
- if in_handle > -1
- out_handle := Fcreate(new_file,FC_NORMAL)
- if out_handle > -1
- do while (nBytes :=fread(in_handle,@buffer,BUFSIZE)) > 0
- fwrite(out_handle,upper(buffer),nBytes)
- buffer :=space(BUFSIZE)
- enddo
- fwrite(out_handle,upper(buffer),nBytes)
- Fclose(in_handle)
- Fclose(out_handle)
- else
- ? "Error ",Ferror()," creating file ",new_file
- endif
- else
- ? "Error ",Ferror()," opening file ",old_file
- endif
- return nil
-
- // end of file CHP2404.PRG
-