<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE> {The S-lang C Library Reference}: SLang_load_file</TITLE>
<LINK HREF="cref-62.html" REL=next>
<LINK HREF="cref-60.html" REL=previous>
<LINK HREF="cref.html#toc61" REL=contents>
</HEAD>
<BODY>
<A HREF="cref-62.html">Next</A>
<A HREF="cref-60.html">Previous</A>
<A HREF="cref.html#toc61">Contents</A>
<HR>
<H2><A NAME="SLang_load_file"></A> <A NAME="s61">61. <B>SLang_load_file</B></A></H2>

<P>
<DL>
<DT><B> Synopsis </B><DD><P>Load a file into the interpreter
<DT><B> Usage </B><DD><P><CODE>int SLang_load_file (char *fn)</CODE>
<DT><B> Description </B><DD><P>The <CODE>SLang_load_file</CODE> function opens the file whose name is
specified by <CODE>fn</CODE> and feeds it to the interpreter, line by line,
for execution.  If <CODE>fn</CODE> is <CODE>NULL</CODE>, the function will take
input from <CODE>stdin</CODE>.
<P>If no error occurs, it returns <CODE>0</CODE>; otherwise,
it returns <CODE>-1</CODE>, and sets <CODE>SLang_Error</CODE> accordingly.  For
example, if it fails to open the file, it will return <CODE>-1</CODE> with
<CODE>SLang_Error</CODE> set to <CODE>SL_OBJ_NOPEN</CODE>.
<DT><B> Notes </B><DD><P>If the hook <CODE>SLang_Load_File_Hook</CODE> declared as
<BLOCKQUOTE><CODE>
<PRE>
      int (*SLang_Load_File_Hook)(char *);
</PRE>
</CODE></BLOCKQUOTE>

is non-NULL, the function point to by it will be used to load the
file.  For example, the <B>jed</B> editor uses this hook to load files
via its own routines.
<DT><B> See Also </B><DD><P><CODE>SLang_load_object, SLang_load_string</CODE>
</DL>
<P>
<P>
<P>
<HR>
<A HREF="cref-62.html">Next</A>
<A HREF="cref-60.html">Previous</A>
<A HREF="cref.html#toc61">Contents</A>
</BODY>
</HTML>
