OPENP

Section: C Library Functions (3)
Updated: 3/24/86
Index Return to Main Contents
 

NAME

openp, fopenp - search for file and open it  

SYNOPSIS

#include <sys/file.h>
int openp (searchlist, path, buffer, flags, mode);
char *searchlist, *path, *buffer;
int flags, mode;

#include <sys/file.h>
#include <stdio.h>
FILE *fopenp (searchlist,path,buffer,type);
char *searchlist, *path, *buffer ,*type;  

DESCRIPTION

Openp and fopenp use searchp(3) to search for a file, and open the file when and if it is found. The value returned will be the normal value of open(2) or fopen(3s) -- a file descriptor or FILE pointer on success, and a -1 or a 0 on failure.

Searchlist is assumed to be a list of directory path names separated by colons; one by one, these names are parsed and concatenated (with a separating slash) onto path to form a complete file path name. An attempt is then made to open the file with this name; if successful, openp and fopenp return with a success indication; otherwise, searching continues. If success is achieved, then the resulting pathname is copied into the string buffer, provided by the user. The open and fopen calls are made with the appropriate mode, flags and type as specified by the parameter. The open(2) and fopen(3S) define what mode, flags and type should be respectively.  

SEE ALSO

searchp(3), open(2), fopen(3s), wantread(3), wantwrite(3), fwantread(3), fwantwrite(3)  

DIAGNOSTICS

Openp returns -1 on error (no openable file found); fopenp returns 0.


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
DIAGNOSTICS

This document was created by man2html, using the manual pages.
Time: 16:57:49 GMT, September 23, 2024