I have to write in a binary file these hex values:
my $erase_start = 0x00010000;
my $erase_size = 0x00008000;
And this is the expected result
Using
print WRITEHANDLE sprintf('%08X', $erase_start);
print WRITEHANDLE sprintf('%08X', $erase_size);
I obtain
I was taking a look to pack/unpack capabilities, but I am not a Perl Guru.
You want to write those 32-bit unsigned ints to a binary file. So I guess you want something like this:
open my $fh, ">", "file.dta" or die;
binmode($fh);
print $fh pack("N*", 0x00010000, 0x00008000); #one or more u32 values
close($fh);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments