kepler has asked for the wisdom of the Perl Monks concerning the following question:
Greetings
I'm trying to arrange a process of saving double or single precison numbers to a binary file for later access via C or VB code. Another factor is that the file has to be saved either in little endian or big endian mode.
I've found this code:
open(my $out, '>:raw', 'sample.bin') or die "Unable to open: $!"; print $out pack('s<',255) ; close($out);
which is supose to save the value 255 as a short variable. Can someone please help me to create a process to save a sequence of 2 or 3 numbers, either in single or double precision, and either in big or little endian? I supose that the sequencial part is made by the append operator (my $out, '>>:raw', 'sample.bin'), and the double or single precision with a letter diferent of 's' (maybe 'd'?). As for the little/big endian, I have no idea...
Kind regards,
Kepler
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl binary file
by BillKSmith (Monsignor) on Dec 30, 2017 at 20:59 UTC | |
|
Re: Perl binary file
by kepler (Scribe) on Dec 29, 2017 at 08:37 UTC | |
by soonix (Chancellor) on Dec 29, 2017 at 10:01 UTC | |
by Anonymous Monk on Dec 31, 2017 at 09:35 UTC | |
|
Re: Perl binary file
by Anonymous Monk on Dec 29, 2017 at 09:18 UTC |