Thread problem mit kopieren von dateien (3 answers)
Opened by pracetzy at 2008-01-10 21:29

styx-cc
 2008-01-10 21:49
#104581 #104581
User since
2006-05-20
533 Artikel
BenutzerIn

user image
schau dir mal sysread und syswrite an, ein aehnliches problem hatte ich beim verschluesseln von bildern, den quelltext haenge ich dir unten einfach mal dran.

MfG

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
sub crypto {
  my $file = shift;
  my $action = shift;
  my $op = $action eq 'encrypt' ? '>' : '<';
  my $suffix = $action eq 'encrypt' ? '.aes' : '';

  my $fh;
  open($fh, "$op:via(PerlIO::via::CBC)", "$file$suffix");
      if ($action eq 'encrypt') {
        open(SOURCE, '<', $file) or die $!;
          print $fh $_ while(sysread(SOURCE, $_, 1024));
        close SOURCE;
      } else {
        open PLAIN, '>', "$file.jpg" or die $!;
          print PLAIN <$fh>;
        close PLAIN or die $!;
      }
  close $fh;
  return 1;
}
1;
Pörl.

View full thread problem mit kopieren von dateien