Go to the first, previous, next, last section, table of contents.


searchpath

Syntax

#include <dir.h>
 
char * searchpath(const char *file);

Description

Given a name of a file in file, searches for that file in a list of directories, including the current working directory and those defined in the PATH environment variable.

Return Value

When successfull, the function returns a pointer to a static buffer where the full pathname of the found file is stored. Otherwise, it returns NULL.

Portability

not ANSI, not POSIX

Example

  printf("%s was found as %s\n", argv[1], searchpath(argv[1]));
 


Go to the first, previous, next, last section, table of contents.