![]() |
![]() |
4 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use strict;
my $diafile="RT_4.dia";
open(FDIA, $diafile) or die "cannot open $diafile";
my @s = stat($diafile);
print "Dateigroesse ",$s[7]," Bytes\n";
my $rec;
my $totlen=0;
my $template = "d";
my $len = length pack($template,0.);
while (1) {
my $res=read(FDIA,$rec,$len);
if (!defined($res)) {print $totlen," error"; last;};
if ($res==0) {print "OK\n"; last;};
if ($res<$len) {print $res,"<",$len," length_read=",$totlen+$res; last;};
$totlen+=$len;
}
Quoteausprobiert?'perldoc -fbinmode'
if ($res==0) {print "OK\n"; last;};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use strict;
use warnings;
my $diafile="RT_4.dia";
open(FDIA, $diafile) or die "cannot open $diafile";
my $read_len = 8;
my $tot_len = 0;
my $file_len = (stat($diafile))[7];
print "Dateigroesse $file_len Bytes\n";
while ( my $len = sysread(FDIA, my $rec, $read_len) ) { # bis eof lesen
if (!defined $len) {
next if $! =~ /^Interrupted/;
die "system read error: $!";
}
# $rec Verarbeitung
$tot_len += $len;
warn "read $tot_len/$file_len\n";
}
if ($res==0) {print "OK\n"; last;};
![]() |
![]() |
4 Einträge, 1 Seite |