home *** CD-ROM | disk | FTP | other *** search
- FCOPY - C function to perform file copies.
-
- This archive contains the following files:
-
- fcopy.c
- fcopy.h
- farread.asm
- copytest.c
- copytest.exe
- readme (this file)
-
- _fcopy is a C function that copies one file to another, much like
- the DOS COPY command. It operates on single files only (i.e., does
- not accept wildcards). To copy multiple files, _fcopy must be used
- in a loop with findfirst and findnext functions (Turbo C++ library
- -- other compilers have similar names).
-
- _fcopy also does not check to see if the specified files are the
- same, so it is up to the calling function to verify that the two
- file specs do not, in fact, refer to the same file.
-
- The _fcopy function calls the functions _farread and _farwrite
- (written in assembler) to perform the actual reads and writes.
- Source for both is contained in the file FARREAD.ASM.
-
- Usage for the function in a C program is as follows:
-
- #include "fcopy.h"
- int _fcopy (char *sourcename, char *destname)
-
- The function returns 0 on success, and -1 if an error occurred. On
- failure, the global variables errno and _doserrno are set to one of
- the following:
-
- EINVFNC Invalid function number (1)
- ENOFILE File not found (2)
- ENOPATH Path not found (3)
- EMFILE Too many open files (4)
- EACCESS Permission denied (5)
- EBADF Bad file number (6)
- ECONTR Memory blocks destroyed (7)
- ENOMEM Not enough core (8)
- EINVMEM Invalid memory block address (9)
- EINVACC Invalid access code (12)
- -1 Target disk full (-1)
-
- See the source code for more information.
-
- A short demo program (COPYTEST.EXE) is included. It prompts the
- user for source and target filenames and then performs the copy. If
- an error occurred during the copy operation, an error message is
- displayed. (This simple program does NOT test the source and
- target filenames to detect whether they actually refer to the same
- file.)
-
- To compile the demo program using Turbo C++, use the following
- command line (for the default memory model):
-
- tcc -Tmx copytest fcopy farread.asm
-
- Other memory models are supported; compile by defining the macro
- _model=[model], where model is small, medium, compact, large, or
- huge. Example:
-
- tcc -ml -Tmx -Td_model=large copytest fcopy farread.asm
-
-
- Ray Waters
- CompuServe ID 72261,33
- January 5, 1992
-