<div dir="ltr"><br><div class="gmail_extra">Hi Libor,<br></div><div class="gmail_extra">Probably it has something to do reading binary file though not sure. Try reading the binary file[1].<br><br>[1] <a href="http://www.haskell.org/haskellwiki/DealingWithBinaryData">http://www.haskell.org/haskellwiki/DealingWithBinaryData</a><br>
</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 11, 2013 at 2:40 PM, Libor Wagner <span dir="ltr">&lt;<a href="mailto:liborwagner@gmail.com" target="_blank">liborwagner@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
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:<br>
<br>
module Main where<br>
<br>
import System.Environment<br>
<br>
main :: IO ()<br>
main = do<br>
[f] &lt;- getArgs<br>
s &lt;- readFile f<br>
putStr s<br>
<br>
When this is called with the test file I have copied from the real location it works fine:<br>
<br>
$ cat /sys/bus/w1/devices/28-000004e46240/w1_slave &gt;test.txt<br>
$ ./ds18b20 test.txt<br>
53 01 4b 46 7f ff 0d 10 e9 : crc=e9 YES<br>
53 01 4b 46 7f ff 0d 10 e9 t=21187<br>
<br>
<br>
<br>
How ever when called with the real location nothing happens:<br>
<br>
$ ./ds18b20 /sys/bus/w1/devices/28-000004e46240/w1_slave<br>
<br>
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.<br>
<br>
Thanks<br>
Libor<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</blockquote></div><br></div></div>