Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RLIB 3.0a Reference - <b>function:</b> pathto() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    PATHTO()

Purpose:     Search the DOS path for the path leading to a given filename.

Syntax:      PATHTO( filename )

Arguments:   filename    - Character string indicating the name of the
                           file to locate through the DOS path.

Returns:     A character string indicating the path pointing to <filename>
             plus a trailing backslash '\'.  If the file is not found
             along the DOS path, a null string ("") is returned.

Description: PATHTO() is an environment/character function used to search
             the current DOS path to find the path pointing to <filename>.
             This can be used to build a fully qualified filename (such as
             d:[path]filename) as a character string to be used to open a
             file.  In the example below, a help file is kept in the same
             drive and directory as the program (.EXE) file.  The path to
             the .EXE file is found and used to point to the help file.
             This way, the help file can be located at runtime, provided
             the .EXE file is in a directory that is in the DOS path.

Notes:       PATHTO() only searches the DOS environment variable PATH so
             it will only find files that are located in a drive or
             directory that is listed in the path.

Example:     *-- Example program name is DEMO.EXE, and help file is named
             *-- DEMO.HLP and both are located in C:\MYAPPS.
             *-- path=C:\;C:\DOS;C:\CLIPPER;C:\UTILITY;C:\MYAPPS

             PROCEDURE Help
             PARAMETERS a,b,c
             helppath = PATHTO("demo.exe")       && returns "C:\MYAPPS\"
             helpfile = helppath + "DEMO.HLP"    && "C:\MYAPPS\DEMO.HLP"

             IF FILE(helpfile)
                USE (helpfile)
                *-- <help code goes here>
             ENDIF
             RETURN

Source:      RL_PATHT.PRG

See also:    PARENT()

See Also: PARENT()

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