Guardian C Library Calls Reference Manual

Reference to Library Calls
Guardian TNS C Library Calls Reference Manual128833 3-131
__ns_fopen_special (supplementary)
Usage Guidelines
If you want to specify the sync depth, call the __ns_fopen_special function from
primary process instead of the fopen function. Otherwise, __ns_fopen_special
operates the same as the fopen function.
For buffered file operations, a call to a write function in user code does not
necessarily correspond to one write operation at the operating system level where
the sync-depth value is meaningful. An operating system write operation is
performed in the following situations:
A flush operation is performed, such as a call to the fflush, fclose, or exit
function.
The buffer is filled.
You can disable buffering with the setvbuf or setnbuf function.
If a device does not support the sync-id mechanism and a sync_depth value is
specified, a value of one (1) is used for sync_depth.
The possible values of the string *access_mode are:
If you attempt to open a file in read mode and the file does not exist or cannot be
read, __ns_fopen_special fails, returning the pointer value NULL.
“r” Open an existing text file for read-only access.
“w” Create a text file (or truncate an existing text file to length zero) and open
it for write-only access.
“a” Create a text file (or open an existing text file) and open it for append
(write at the end of the file) access.
“r+” Open an existing text file for update access (reading and writing).
“w+” Create a text file (or truncate an existing text file to length zero) and open
it for update access.
“a+” Create a text file (or open an existing text file) and open it for update
access with writing at the end of the file.
“rb” Open an existing binary file for read-only access.
“wb” Create a binary file (or truncate an existing binary file to length zero) and
open it for write-only access.
“ab” Create a binary file (or open an existing binary file) and open it for
append (write at the end of the file) access.
“rb+” Open an existing binary file for update access (reading and writing).
“wb+
Create a binary file (or truncate an existing binary file to length zero) and
open it for update access.
“ab+” Create a binary file (or open an existing binary file) and open it for
update access with writing at the end of the file.