From: Mika Laitio Date: Sat, 30 Oct 2010 18:06:41 +0000 (+0300) Subject: fix the parsing of counter value X-Git-Url: http://pilppa.org/gitweb/?p=lib1wire.git;a=commitdiff_plain;h=8d60415d0ff1fd01d65e9d57291e6fd5c454959c fix the parsing of counter value --- diff --git a/src/W1CounterDevice.cc b/src/W1CounterDevice.cc index d339562..5e343bf 100644 --- a/src/W1CounterDevice.cc +++ b/src/W1CounterDevice.cc @@ -59,10 +59,10 @@ string W1CounterDevice::get_value() { while(getline(ifs, value_line)) { length = value_line.length(); if (length > 0) { - pos = value_line.find("c="); + pos = value_line.find("crc=YES c="); if ((pos >= 0) && - (pos + 2 < length)) { - value_line = value_line.substr(pos + 2); + (pos + 10 < length)) { + value_line = value_line.substr(pos + 10); } else { value_line = "";