Reading terms from a file

Hakan Stenholm <>
Wed Nov 21 18:45:10 CET 2001


This should do the job:

-------------------------------------------------------

file:consult(Filename)

Opens file Filename and reads all the Erlang terms in it. Returns one of the
following: 

      {ok, TermList} 
            The file was successfully read. 
      {error, Atom} 
            An error occurred when opening the file or reading it. The Atom is
            a Posix error code. See the description of open/2 for a list of
            typical error codes. 
      {error, {Line, Mod, Term}} 
            An error occurred when interpreting the Erlang terms in the file.
            Use the format_error/1 function to convert the three-element tuple
            to an English description of the error. 




More information about the erlang-questions mailing list