[Haskell-beginners] Read file from sys

Libor Wagner liborwagner at gmail.com
Sat May 11 14:25:37 CEST 2013


Hi, 

thanks for suggestion, I have tried 's  <- readProcess "cat"  [w1paht] []'. Probably not a cleanest solution but it works.

Libor 


On Saturday, May 11, 2013 at 13:50, mukesh tiwari wrote:

> 
> Hi Libor,
> Probably it has something to do reading binary file though not sure. Try reading the binary file[1].
> 
> [1] http://www.haskell.org/haskellwiki/DealingWithBinaryData
> 
> On Sat, May 11, 2013 at 2:40 PM, Libor Wagner <liborwagner at gmail.com (mailto: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 (mailto:Beginners at haskell.org)
> > http://www.haskell.org/mailman/listinfo/beginners
> 






More information about the Beginners mailing list