HPlogo MPE/iX Intrinsics Reference Manual > Chapter 7 Command Definitions (HP32208-HPLOACNMPROC)

HPFDUPLICATE

MPE documents

Complete PDF
Table of Contents
Index

Edition 7 E0701 ♥
Edition 7 E0300
Edition 6 E0195

NM callable only.

Creates duplicate file descriptors for files opened for MULTI, SHARED, or EXCLUSIVE access.

Syntax



  I16                      I32V    I32     I32
  filenum := HPFDUPLICATE (source, status, target);

Functional Return


filenum

16-bit signed integer (assigned functional return)

Returns the actual file number used to duplicate the source file. This file number can be different than the file number requested in the target parameter. If an error occurs during the duplication process, a -1 value is returned.

Parameters


source

32-bit signed integer by value (required)

Specifies the file number to be duplicated. The file number must be a valid, open file.

status

32-bit signed integer by reference (optional)

Returns the status of the HPFDUPLICATE call. If an error occurs and this parameter was not specified, the functional return can be used to determine the success or failure of the call.

target

32-bit signed integer by reference (optional)

Specifies the file number to be duplicated in the source parameter. If the file number is already opened, the next highest available file number is used. The value passed must be within the legal range of file numbers. The default value for this parameter is zero (0).

Operation Notes


When a file descriptor is duplicated, the duplicate file descriptor shares the same data pointer as the original file descriptor in the same way that file descriptors share the same data pointer with MULTI access. This gives you the ability to perform operations on files that have not been previously available. Specifically, files that are opened for SHARED or EXCLUSIVE access can now have their data pointers shared among multiple file descriptors, at the discretion of the application that originally opens the file descriptor.

Related Information


Intrinsics FCLOSE, FOPEN, FRENAME, HPFOPEN, HPPIPE
Manuals




HPFADDTOPOINTER


HPFFILLDATA