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 :-(
In reply to Re^2: comparison of packed signed integers
by gerleu
in thread comparison of packed signed integers
by gerleu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |