[Haskell-beginners] Read file from sys
Libor Wagner
liborwagner at gmail.com
Sat May 11 11:10:41 CEST 2013
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
More information about the Beginners
mailing list