krot

readlines

Dec 17th, 2019
694
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. readlines(FileName) ->
  2.     {ok, Device} = file:open(FileName, [read]),
  3.     try get_all_lines(Device)
  4.       after file:close(Device)
  5.     end.
  6.  
  7. get_all_lines(Device) ->
  8.     case file:read_line(Device) of
  9.     {ok,Data} ->[string:trim(Data)|get_all_lines(Device)];
  10.     _->[]
  11.     end.
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×