I have a four-byte string read from a binary file, which is supposed to represent an integer. How do I dervive the integer?
Example:
my $s = '\xa8e2~';
my $i = stoi($s);
printf "%X", $i; #gives "0x7e3265a8"
The solution in C is simply:
fread(&i,4,1,fp);