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 Library Reference - <u>synopsis:</u> 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 *pathname );
    void _wsearchenv( const wchar_t *name,
                      const wchar_t *env_var,
                            wchar_t *pathname );

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
    pathname.  If the specified file cannot be found, then pathname will
    contain an empty string.

    The _wsearchenv function is a wide-character version of _searchenv that
    operates with wide-character strings.

Returns:
    The _searchenv function returns no value.

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:
     _searchenv - All

    _wsearchenv - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32

See Also:
    getenv, setenv, _splitpath, putenv

See Also:

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