home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP24.EXE / CHP2404.PRG < prev    next >
Encoding:
Text File  |  1991-04-30  |  979 b   |  36 lines

  1. /*
  2.    Listing 24.4  Ucopy()
  3.    Author: Joe Booth
  4.    Excerpted from "Clipper 5: A Developer's Guide"
  5.    Copyright (c) 1991 M&T Books
  6.                       501 Galveston Drive
  7.                       Redwood City, CA 94063-4728
  8.                       (415) 366-3600
  9. */
  10.  
  11. #include "FILEIO.CH"
  12. #define   BUFSIZE 2048
  13.  
  14. function Ucopy(old_file,new_file)
  15. LOCAL in_handle,out_handle,buffer:=space(BUFSIZE),nbytes
  16. in_handle := Fopen(old_file,FO_READ)
  17. if in_handle > -1
  18.    out_handle := Fcreate(new_file,FC_NORMAL)
  19.    if out_handle > -1
  20.       do while (nBytes :=fread(in_handle,@buffer,BUFSIZE)) > 0
  21.          fwrite(out_handle,upper(buffer),nBytes)
  22.          buffer :=space(BUFSIZE)
  23.       enddo
  24.       fwrite(out_handle,upper(buffer),nBytes)
  25.       Fclose(in_handle)
  26.       Fclose(out_handle)
  27.    else
  28.       ? "Error ",Ferror()," creating file ",new_file
  29.    endif
  30. else
  31.    ? "Error ",Ferror()," opening file ",old_file
  32. endif
  33. return nil
  34.  
  35. // end of file CHP2404.PRG
  36.