Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am writing a Perl script to convert a .elf file to .txt file but It is failing in a initial state?
Actual program going to convert a .elf to .txt file format with 80 character in a line. If the .txt would reach 1GB then stop the conversion and exit.
Can somebody help me? Am I using “pack” correctly?#!/usr/bin/perl
use strict;
my @in;
my $inputfile;
my $outputfile;sub totext() {
my @in;
my $out;
my $x;@in = @_;
open(OUTPUT, ">$outputfile") || die "Error: unable to open $outputfile - $!\n";
for($x=0; $x<=$#in; $x++) {
$out = pack("B*", $in[$x]);
print OUTPUT $out;
} print("\n");
}
$inputfile = $ARGV[0];
$outputfile = $ARGV[1];
open(INPUT, "<$inputfile") || die "Error: unable to open $inputfile - $!\n";
@in = <INPUT>;
close(INPUT);
if (!@in) {
print("Error: no data in $inputfile\n");
exit(1);
}
&totext(@in);

![]() |
Using Javascript under WS...
|
Batch copy files on txt f...
|
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |