- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My education is clearly sorely lacking in terms of real numbers in Hex or Binary Format.
I have a binary file that I can nicely read with Hex Editor. I found after a few weeks of using the program it has a button to turn the hex code in real4 numbers as shown. The first column is just small count column, the second column is the barometric pressure, the third is random garbage and the fourth is some counter. Each line is one second apart in real time.
I understand how the 7c307c44 can be translated to a large decimal, but how in Fortran do I get the real number that is within the Hex code. The JSON file for this dat file says they are floats, which I assume is C standard.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is easy enough:
- Open the file as "acess = 'stream' - this defaults to unformatted reading
- Then in a loop, read one real at a time
- Print the real
If you want some code (not tested, so caveat emptor for typos):
integer :: i
real :: x
open( 10, file = 'mydata', access = 'stream' )
do i = 1,20
read( 10 ) x
write(*,*) x
enddoIf you get sensible numbers, then you know you are on the right track. Looking at the screenshots, I'd say, this should do it.
Of course, I have no idea what the internal organisation of the file is (grouping of the data in records or the like).
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page