[erlang-questions] File IO
Vlad12
vsarpe@REDACTED
Fri May 16 20:25:50 CEST 2008
Hi, I am trying to create an erlang program that takes a binary trace file
and converts it into normal text.
My question is, how can i write a bunch of terms to a file. Here is how my
code looks like, but using different terms (in string representation) and
this compiles, runs, but produces an empty file. Am I missing something
important?
-module(test).
-export([write/1]).
-import(lists,[foreach/2]).
write(WriteFile) ->
{ok, WriteDescr} = file:open(WriteFile, [raw, write]),
Terms = ["one","two","three","four","five"],
Writer=fun(Term) -> file:write(WriteDescr, Term) end,
lists:foreach(Writer, Terms).
Vlad.
--
View this message in context: http://www.nabble.com/File-IO-tp17281272p17281272.html
Sent from the Erlang Questions mailing list archive at Nabble.com.
More information about the erlang-questions
mailing list