[erlang-questions] file:read_file won't read from /proc

Robert Virding <>
Fri Mar 5 16:26:36 CET 2010

In your original question you showed a way of doing this using
file:open, file:read and file:close. By doing file:read until it
returns eof you should be able to read the whole file. It won't be
very efficient for large files but for small files there should be no


On 5 March 2010 10:57, Martin DeMello <> wrote:
> On Thu, Mar 4, 2010 at 9:37 PM, Jachym Holecek <> wrote:
>> The read_file/1 thing check file size and then attempts to read exactly
>> that many bytes. The size of /proc/cpuinfo is zero[*], thus read_file/1
>> correctly reads zero bytes and represents the result with empty binary.
> Okay, that makes sense. So what would the best way to read "files" in
> /proc be? Is there any standard erlang way to read a stream till you
> get an EOF?
> martin
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:

More information about the erlang-questions mailing list