fscopy

Copies a file, or a portion of a file, to another file.

Library:LibC
Classification:Novell
Service:File and Directory I/O

Syntax

  #include <fsio.h> 
   
  int fscopy (
     int       fildes1,
     int       fildes2,
     off64_t   offset1,
     off64_t   offset2,
     size_t    length,
     size_t   *nbytes );
  

Parameters

fildes

(IN) Specifies the source file from which to copy data.

fildes

(IN) Specifies the destination file into which data is copied.

offset1

(IN) Specifies the offset (in bytes) in the source file where copy should begin.

offset2

(IN) Specifies the offset (in bytes) in the destination file where the data should be copied.

length

(IN) Specifies the number of bytes to copy.

nbytes

(OUT) Points to the number of bytes actually copied.

Return Values

If successful, returns 0. Otherwise, returns -1 and sets errno.

Decimal

Constant

Description

4

EBADF

The fides parameter does not specify an open file.

5

ENOMEM

The system is unable to allocate resources.

6

EACCES

The caller has insufficient rights.

105

ENOCONTEXT

The calling thread has no context.

Remarks

A file handle can be obtained by calling the open, sopen, or creat function.

To copy from the beginning of the source file to a new file, set the offset1 and offset2 parameters to 0x00.To copy the entire source file, specify a value in the length parameter that matches or exceeds the file size.

See Also