home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / C / FCOPY / README < prev    next >
Text File  |  1993-12-01  |  4KB  |  98 lines

  1. FCOPY - C function to perform file copies.
  2. Version 3.1
  3.  
  4.      This archive contains the following files:
  5.  
  6.           readme              (this file)
  7.           fcopy.c             (source for fcopy)
  8.           fcopy.h             (function protoypes and misc. defines)
  9.           copyfile.asm        (source for actual read/write operations)
  10.           truename.asm        (source for function to get true pathspec)
  11.           strtrim.asm         (source to trim leading/trailing spaces)
  12.           farread.asm         (source to read file into a far buffer)
  13.           farwrite.asm        (source to write file from a far buffer)
  14.           copytest.c          (source for demo program)
  15.           copytest.exe        (demo program)
  16.           fcopys.lib          (small model library)
  17.           fcopyc.lib          (compact model library)
  18.           fcopym.lib          (medium model library)
  19.           fcopyl.lib          (large model library)
  20.           fcopyh.lib          (huge model library)
  21.           fcopy21.zip         (version 2.1 of fcopy)
  22.           whats.new           (changes since version 2.0)
  23.  
  24.      fcopy is a C function that copies one file to another, much like
  25.      the DOS COPY command.  It operates on single files only (i.e., does
  26.      not accept wildcards).  To copy multiple files, fcopy must be used
  27.      in a loop with findfirst and findnext functions (included in the
  28.      Turbo C++ library -- other compilers have similar names).
  29.  
  30.      This version of fcopy checks to see if the source and target file
  31.      names actually refer to the same file (example: file.ext and
  32.      .\file.ext are actually the same file).  This will prevent fcopy
  33.      from attempting to copy a file onto itself; trying to do so will
  34.      usually corrupt the file unless it is very small in size.
  35.  
  36.      The primary function fcopy is written in C (source included), and
  37.      performs the high level functions of opening and closing files and
  38.      allocating memory for the file buffer.  All other functions
  39.      are written in assembler to be callable from C.  Assembler source
  40.      for all of these modules is also included.
  41.  
  42.      The assembler modules support all memory models by defining the
  43.      symbol _model=[model], where model is small, medium, compact,
  44.      large, or huge.  For example:
  45.  
  46.          tasm /mx /d_model=large truename
  47.  
  48.      will assemble the truename module using the large memory model.
  49.  
  50.      A function to trim leading and trailing white space from a string
  51.      (strtrim) has been included.  While not absolutely essential, it
  52.      does allow the programmer to ensure that a filespec passed to DOS
  53.      has no leading and trailing spaces.  For example, the DOS function
  54.      to open a file (and the one that finds its truename) will fail if
  55.      the filename string has not been trimmed.  The demonstration
  56.      program uses this function to ensure that fcopy and its supporting
  57.      functions work properly.
  58.  
  59.      Usage for the function in a C program is as follows:
  60.  
  61.           #include "fcopy.h"
  62.           int fcopy (char *sourcename, char *targetname)
  63.  
  64.      The function returns 0 on success.  If fcopy fails, it returns -1
  65.      and sets the global variables errno and _doserrno to one of the
  66.      following:
  67.  
  68.                EINVFNC     Invalid function number  (1)
  69.                ENOFILE     File not found  (2)
  70.                ENOPATH     Path not found  (3)
  71.                EMFILE      Too many open files  (4)
  72.                EACCESS     Permission denied  (5)
  73.                EBADF       Bad file number  (6)
  74.                ECONTR      Memory blocks destroyed  (7)
  75.                ENOMEM      Not enough core  (8)
  76.                EINVMEM     Invalid memory block address  (9)
  77.                EINVACC     Invalid access code  (12)
  78.                DISKFUL     Target disk full  (-2)
  79.                NOCOPY      Cannot copy file onto itself (-3)
  80.  
  81.      See the source code for more information.
  82.  
  83.      A short demo program (COPYTEST.EXE) is included.  It prompts the
  84.      user for source and target filenames and then performs the copy.
  85.      If an error occurs during the copy operation, an error message is
  86.      displayed.
  87.  
  88.      To compile the demo program using Turbo C++, use the following
  89.      command line (for the small model):
  90.  
  91.          tcc -ms copytest fcopys.lib
  92.  
  93.  
  94.  
  95.      Ray Waters
  96.      CompuServe ID 72261,33
  97.      May 12, 1992
  98.