ZOPEN

Section: C Library Functions (3)
Index Return to Main Contents

BSD mandoc
 

NAME

zopen - compressed stream open function  

SYNOPSIS

Fd #include <stdio.h> Ft FILE * Fn zopen const char *path const char *mode int bits  

DESCRIPTION

The Fn zopen function opens the compressed file whose name is the string pointed to by Fa path and associates a stream with it.

The argument Fa mode points to one of the following one-character strings:

``r ''
Open compressed file for reading. The stream is positioned at the beginning of the file.
``w ''
Truncate file to zero length or create compressed file for writing. The stream is positioned at the beginning of the file.

Any created files will have mode \*q S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH \*q (0666 ) as modified by the process' umask value (see umask(2)).

Files may only be read or written. Seek operations are not allowed.

The Fa bits argument, if non-zero, is set to the bits code limit. If zero, the default is 16. See Fn compress 1 for more information.  

RETURN VALUES

Upon successful completion Fn zopen returns a FILE pointer. Otherwise, NULL is returned and the global variable errno is set to indicate the error.  

ERRORS

Bq Er EINVAL
The Fa mode or Fa bits arguments specified to Fn zopen were invalid.
Bq Er EFTYPE
The compressed file starts with an invalid header, or the compressed file is compressed with more bits than can be handled.

The Fn zopen function may also fail and set errno for any of the errors specified for the routines fopen(3) or funopen(3).  

SEE ALSO

compress(1), fopen(3), funopen(3)  

HISTORY

The zopen function first appeared in BSD 4.4  

BUGS

The Fn zopen function may not be portable to systems other than BSD .


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
ERRORS
SEE ALSO
HISTORY
BUGS

This document was created by man2html, using the manual pages.
Time: 04:30:01 GMT, April 24, 2025