in reply to Re: Binary to decimal conversion
in thread Binary to decimal conversion
And I believe that's PHP, not Perl. I'm thankful for the suggestion although still looking for the Perl equivalent of the above.153 // read number 154 function readNumber(){ 155 $num = fread($this->buffer, 8); 156 $r = ""; 157 for($byte = 7 ; $byte >= 0 ; $byte--) { // reverse the bytes 158 $r .= $num[$byte]; 159 } 160 $ret = unpack("dnum",$r); 161 return $ret['num']; 162 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Binary to decimal conversion
by Anonymous Monk on Dec 11, 2007 at 10:06 UTC |