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


Changing the Search Path

The search path is initialized when you start Gforth (see section Invoking Gforth). You can display it with

.fpath       --         gforth       ``.fpath''

displays the contents of the forth search patch

You can change it later with the following words:

fpath+       "dir"         gforth       ``fpath+''

adds a directory to the forth search path

fpath=       "dir1|dir2|dir3"         gforth       ``fpath=''

makes complete new searchpath, serpeator is |

Using fpath and require would look like:

fpath= /usr/lib/forth/|./

require timer.fs

If you have the need to look for a file in the Forth search path, you could use this Gforth feature in your application.

open-fpath-file       adr len -- fd adr1 len2 0 | ior         gforth       ``open-fpath-file''

looks in the forth search path for the file specified by adr len when found the resulting path and an open file descriptor is returned. If the file is not found ior is non zero


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