Readers: 7
![]() |
|< 1 2 3 >| | ![]() |
27 entries, 3 pages |
1
2
3
4
5
6
7
8
9
10
11
use strict;
open(FILE, "> movie.mov") or die;
binmode(FILE);
my $hexcode = "ac4165ffff32765ff3";
for(my $i = 0; $i < length($hexcode); $i += 2)
{
print FILE chr(hex(substr($hexcode, $i, 2)));
}
close(FILE);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
open(FILE, "> VIDEO.AVI") or die;
binmode(FILE);
my $hexcode = "52 49 46 46 f8 e9 08 00 41 ... ";
$hexcode =~ s/ //g;
for(my $i = 0; $i < length($hexcode); $i += 2)
{
print FILE chr(hex(substr($hexcode, $i, 2)));
}
close(FILE);
open(IN, "< TTVIDEO.AVI") or die "can't open $oldfile: $!";
open(OUT, ">> VIDEO.AVI") or die "can't open $newfile: $!";
binmode(IN);
binmode(OUT);
$blksize = (stat IN)[11] || 16384; # preferred block size?
while ($len = sysread IN, $buf, $blksize) {
if (!defined $len) {
next if $! =~ /^Interrupted/; # ^Z and fg
die "System read error: $!\n";
}
$offset = 0;
while ($len) { # Handle partial writes.
defined($written = syswrite OUT, $buf, $len, $offset)
or die "System write error: $!\n";
$len -= $written;
$offset += $written;
};
}
close(IN);
close(OUT);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
open(IN, "< TTVIDEO.AVI") or die "can't open $oldfile: $!";
open(OUT, "> VIDEO.AVI") or die "can't open $newfile: $!";
binmode(IN);
binmode(OUT);
my $hexcode = "52 49 46 46 f8 e9 08 00 41 ... ";
for(my $i = 0; $i < length($hexcode); $i += 3)
{
print OUT chr(hex(substr($hexcode, $i, 2)));
}
$blksize = (stat IN)[11] || 16384; # preferred block size?
while ($len = sysread IN, $buf, $blksize) {
if (!defined $len) {
next if $! =~ /^Interrupted/; # ^Z and fg
die "System read error: $!\n";
}
$offset = 0;
while ($len) { # Handle partial writes.
defined($written = syswrite OUT, $buf, $len, $offset)
or die "System write error: $!\n";
$len -= $written;
$offset += $written;
}
}
close(OUT);
close(IN);
![]() |
|< 1 2 3 >| | ![]() |
27 entries, 3 pages |