I got binary file, that contains doubles. How do i print that out to a terminal. I've tried octaldump 'od' but cant figure out the syntax I've tried something like
head -c80 |od -f
But that doesnt work, the man page for od is extremely bad.
I've made a c program that does what I want, something like assuming 10double chunks.
double tmp[10];
while(fread(tmp,sizeof(double),10,stdin))
for(int i=0;i<10;i++) printf("%f\t",tmp[i]);
thanks.
Have you tried hexdump utility?
hexdump -e ' [iterations]/[byte_count] "[format string]" ' filename
Where format string should be "%f"
, byte count should be 8, and iterations the amount of floats you want to read
The od
command you're looking for is
od -t fD
(That means "floating point values, of double
size").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With