noclosecopy
Purpose
Copies a file without closing it.
Library
Security Library (libs.a)
Syntax
int noclosecopy (flag, fd, old, new)
int flag, fd;
char *old, *new;
Description
The noclosecopy subroutine reads the entire contents of
the old file into memory with one read system call, and
then writes the contents to the new file with one write
system call. When the flag parameter is 0, the fd param-
eter is the file descriptor of the old file, and when the
flag parameter is 1, the fd parameter is the file
descriptor of the new file. In either case, fd is not
closed by the noclosecopy subroutine and any existing
locking is not saved.
Return Value
The noclosecopy subroutine returns 0 for success and one
of the following negative numbers for failure:
-1 The flag parameter is not valid.
-2 Cannot reset the read/write file pointer of
file.
-3 Cannot stat file.
-4 Cannot open file.
-5 Cannot read file.
-6 Cannot write file.
-7 Cannot truncate file.
-8 The malloc system call failed.
Related Information
In this book: "tbl."