home *** CD-ROM | disk | FTP | other *** search
/ Prima Shareware 3 / DuCom_Prima-Shareware-3_cd1.bin / PROGRAMO / C / FCOPY / README < prev   
Encoding:
Text File  |  1992-01-04  |  2.7 KB  |  71 lines

  1. FCOPY - C function to perform file copies.
  2.  
  3.      This archive contains the following files:
  4.  
  5.           fcopy.c
  6.           fcopy.h
  7.           farread.asm
  8.           copytest.c
  9.           copytest.exe
  10.           readme (this file)
  11.  
  12.      _fcopy is a C function that copies one file to another, much like
  13.      the DOS COPY command.  It operates on single files only (i.e., does
  14.      not accept wildcards).  To copy multiple files, _fcopy must be used
  15.      in a loop with findfirst and findnext functions (Turbo C++ library
  16.      -- other compilers have similar names).
  17.  
  18.      _fcopy also does not check to see if the specified files are the
  19.      same, so it is up to the calling function to verify that the two
  20.      file specs do not, in fact, refer to the same file.
  21.  
  22.      The _fcopy function calls the functions _farread and _farwrite
  23.      (written in assembler) to perform the actual reads and writes.
  24.      Source for both is contained in the file FARREAD.ASM.
  25.  
  26.      Usage for the function in a C program is as follows:
  27.  
  28.           #include "fcopy.h"
  29.           int _fcopy (char *sourcename, char *destname)
  30.  
  31.      The function returns 0 on success, and -1 if an error occurred.  On
  32.      failure, the global variables errno and _doserrno are set to one of
  33.      the following:
  34.  
  35.           EINVFNC     Invalid function number  (1)
  36.           ENOFILE     File not found  (2)
  37.           ENOPATH     Path not found  (3)
  38.           EMFILE      Too many open files  (4)
  39.           EACCESS     Permission denied  (5)
  40.           EBADF       Bad file number  (6)
  41.           ECONTR      Memory blocks destroyed  (7)
  42.           ENOMEM      Not enough core  (8)
  43.           EINVMEM     Invalid memory block address  (9)
  44.           EINVACC     Invalid access code  (12)
  45.                -1     Target disk full  (-1)
  46.  
  47.      See the source code for more information.
  48.  
  49.      A short demo program (COPYTEST.EXE) is included.  It prompts the
  50.      user for source and target filenames and then performs the copy. If
  51.      an error occurred during the copy operation, an error message is
  52.      displayed.  (This simple program does NOT test the source and
  53.      target filenames to detect whether they actually refer to the same
  54.      file.)
  55.  
  56.      To compile the demo program using Turbo C++, use the following
  57.      command line (for the default memory model):
  58.  
  59.          tcc -Tmx copytest fcopy farread.asm
  60.  
  61.      Other memory models are supported; compile by defining the macro
  62.      _model=[model], where model is small, medium, compact, large, or
  63.      huge.  Example:
  64.  
  65.          tcc -ml -Tmx -Td_model=large copytest fcopy farread.asm
  66.  
  67.  
  68.      Ray Waters
  69.      CompuServe ID 72261,33
  70.      January 5, 1992
  71.