[erlang-questions] CSV file help

Bengt Kleberg <>
Mon Nov 12 09:04:52 CET 2012


Greetings,

The documentation page for io:file/2 says that the second argument
should be a list of atoms. Like this: [read].
If {ok, String} matches, then you are probably just lucky.


bengt

On Mon, 2012-11-12 at 09:54 +0200, Lucky Khoza wrote:
> Hi Erlang Developers,
> 
> Where do i start in terms of reading CSV file, because i tried to use
> this rountines:
> 
> {ok,String} = file:open("produce.csv",read).
> io:get_line(String, ' ').
> 
> but when i used this rountine: io:get_line(String,' ') to read each
> line i got this tuple: {error,terminated},
> 
> And the file i'm trying to read is like this:
> 
> "Supplier ID","Product Code","Product Description","Delivery
> Date","Unit Price","Number of Units"
> 15,1101,"Apples 1kg Golden Delicious. The sweetest Apples! Always a
> favourite. Love, Mrs. Hollingberry","2012/02/15",1505,5
> 
> Thanks in advance for your help.
> 
> Kindest Regards
> Lucky
> 
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list