{The S-lang C Library Reference}: SLang_load_file

Next Previous Contents

## 61. SLang_load_file

Synopsis

  Load a file into the interpreter

Usage

  `int SLang_load_file (char *fn)`

Description

  The `SLang_load_file` function opens the file whose name is specified by `fn` and feeds it to the interpreter, line by line, for execution. If `fn` is `NULL`, the function will take input from `stdin`.

  If no error occurs, it returns `0`; otherwise, it returns `-1`, and sets `SLang_Error` accordingly. For example, if it fails to open the file, it will return `-1` with `SLang_Error` set to `SL_OBJ_NOPEN`.

Notes

  If the hook `SLang_Load_File_Hook` declared as

  > `

  >           int (*SLang_Load_File_Hook)(char *);

  > `

  is non-NULL, the function point to by it will be used to load the file. For example, the jed editor uses this hook to load files via its own routines.
See Also

  `SLang_load_object, SLang_load_string`

Next Previous Contents