Skip to content

Instantly share code, notes, and snippets.

Created March 29, 2016 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7dd00fc5fba177f6dd2041edfe9ad09e to your computer and use it in GitHub Desktop.
Save anonymous/7dd00fc5fba177f6dd2041edfe9ad09e to your computer and use it in GitHub Desktop.
-module(t).
-compile(export_all).
file_to_list(F) ->
file_to_list(F, []).
file_to_list(F, Acc) ->
case file:read_line(F) of
{ok, Data} ->
NewAcc = [Data | Acc],
file_to_list(F, NewAcc);
eof ->
lists:reverse(Acc)
end.
filename_to_list(Filename) ->
{ok, F} = file:open(Filename, [read]),
file_to_list(F).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment