Reading terms from a file

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Reading terms from a file

Hakan Stenholm
This should do the job:



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

      {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.