forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

reading 4-byte reals

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
Norm.Campbell



Joined: 31 Aug 2007
Posts: 66

PostPosted: Mon Oct 15, 2007 2:45 pm    Post subject: reading 4-byte reals Reply with quote

Someone has sent me an ER Mapper real file, and I thought I knew how to decode it: read each lot of 4 bytes into a character*4 array, and then read the real number from the character array. It didn't give the correct number (which I can get using ER Mapper displays). (And byte swapping crashed the program.)

I then wrote out the correct number using an unformatted write; read the bytes back in; and decoded them using ichar. The 4 numbers for the 4 bytes are different to those from reading in the 4 bytes from the ER Mapper file and decoding them.

What am I doing wrong?

Do I have to go back to the IEEE specification, and do a bit dump to reconstitute the number?
Back to top
View user's profile Send private message
Robert



Joined: 29 Nov 2006
Posts: 445
Location: Manchester

PostPosted: Wed Nov 14, 2007 6:02 pm    Post subject: Reply with quote

Do you have a code fragment?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group