[Haskell-beginners] Read file from sys

emacstheviking objitsu at gmail.com
Sat May 11 12:51:47 CEST 2013


Buffering?

On 11 May 2013 10:10, Libor Wagner <liborwagner at gmail.com> wrote:

> Hi,
>
> I have small code snippet to read content of a file, which should grow
> into simple tool to read temperature from sensor on Raspberry Pi:
>
> module Main where
>
> import System.Environment
>
> main :: IO ()
> main = do
> [f] <- getArgs
> s <- readFile f
> putStr s
>
> When this is called with the test file I have copied from the real
> location it works fine:
>
> $ cat /sys/bus/w1/devices/28-000004e46240/w1_slave >test.txt
> $ ./ds18b20 test.txt
> 53 01 4b 46 7f ff 0d 10 e9 : crc=e9 YES
> 53 01 4b 46 7f ff 0d 10 e9 t=21187
>
>
>
> How ever when called with the real location nothing happens:
>
> $ ./ds18b20 /sys/bus/w1/devices/28-000004e46240/w1_slave
>
> Can someone help? I have thought that the file is not properly ended so I
> have tried to take just first line but that doest work either.
>
> Thanks
> Libor
>
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130511/fddc3a69/attachment.htm>


More information about the Beginners mailing list