in reply to Re: comparison of packed signed integers
in thread comparison of packed signed integers
Hi BrowserUK and thank you for your fast answer :-)
Here is my code for the file creation.
And here is my code for the read and comparison:open(OUT,'>'.$fil) or die $!; binmode OUT; for $i(1 .. 10000){ $lat=int(rand(20000))+440000; $lon=int(rand(10000))+20000; $typ=chr(31); $cod=pack('l>l>C',$lat,$lon,$typ); print OUT $cod; } close(OUT);
$lah=pack('l>',$lah); $lab=pack('l>',$lab); $loh=pack('l>',$loh); $lob=pack('l>',$lob); open(IN,"<ch"; @fil=stat(IN); $num=$fil[7]/9; binmode(IN); for(1 .. $num){ read(IN,$lat,4); read(IN,$lon,4); read(IN,$pyt,1); if(($lat lt $lah) && ($lat gt $lab) && ($lon lt $loh) && ($lon gt $lo +b)){ print "OK"; } }
But it is never OK :-(
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: comparison of packed signed integers
by BrowserUk (Patriarch) on Oct 30, 2011 at 12:16 UTC | |
by gerleu (Novice) on Oct 30, 2011 at 12:36 UTC | |
by gerleu (Novice) on Oct 30, 2011 at 12:51 UTC | |
by BrowserUk (Patriarch) on Oct 30, 2011 at 12:39 UTC |