File reading fun with Elixir and Erlang

To read a file using Elixir File module, all you gotta do is this (if you fire up your iex, and run this - assuming you have your file in the proper location)

In Elixir 

{:ok, wf} = "c:\\tmp\\test2.log"

What if you wanted to write. In that case, we need to open our file using the command below and assigned file handler to a variable called "wf".

 {:ok, wf} = "c:\\tmp\\test3.log"

To write to your already open file handler.

 IO.binwrite wf, "uhh llalala"

Using Erlang 


This also gives us a clue to call Erlang's built in libraries.


Popular posts from this blog

PySpark - Working with JDBC Sqlite database