file:read/2 on stdin?
Bengt Kleberg
bengt.kleberg@REDACTED
Wed Sep 29 17:43:00 CEST 2004
greetings,
is there a way to use file:read/2 to read 1 character from stdin? i have
tried file:read( standard_io, 1). i got {error, einval}.
i used the atom standard_io since the io module will allow it as a
Io_Device. in this case, ie in another module, it did not work.
it has been most intelligently suggested to me that i should use
file:read/2 to get faster line oriented io. (background: i asked about a
faster alternative to io:fread/2 some time ago). this is faster for
regular files. but in this case (see
http://shootout.alioth.debian.org/bench/sumcol, ''About this test'' as
to why i read from stdin) it have trouble using it.
suggestions anyone? it is ok to point me to where ericsson has the
source code to the file module.
bengt
More information about the erlang-questions
mailing list