Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdlib.h>
    void _searchenv( const char *name,
                     const char *env_var,
                     char *buffer );

Description:
    The _searchenv function searches for the file specified by name in the
    list of directories assigned to the environment variable specified by
    env_var.  Common values for env_var are PATH, LIB and INCLUDE.

    The current directory is searched first to find the specified file.  If
    the file is not found in the current directory, each of the directories
    specified by the environment variable is searched.

    The full pathname is placed in the buffer pointed to by the argument
    buffer.  If the specified file cannot be found, then buffer will contain
    an empty string.

Returns:
    The _searchenv function returns no value.

See Also:
    getenv, setenv, _splitpath, putenv

Example:
    #include <stdio.h>
    #include <stdlib.h>

    void display_help( FILE *fp )
      {
        printf( "display_help T.B.I.\n" );
      }

    void main()
      {
        FILE *help_file;
        char full_path[ _MAX_PATH ];

        _searchenv( "watcomc.hlp", "PATH", full_path );
        if( full_path[0] == '\0' ) {
          printf( "Unable to find help file\n" );
        } else {
          help_file = fopen( full_path, "r" );
          display_help( help_file );
          fclose( help_file );
        }
      }

Classification:
    WATCOM

Systems:
    All

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson