|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Wolfgang Hoeppner
Joined: 05 Dec 2006 Posts: 8 Location: Sibiu / Romania
|
Posted: Wed Aug 08, 2007 8:29 pm Post subject: Continued: UNFORMATTED READ |
|
|
Dear Andrew,
thank you very much for your answer. I had found the SUBROUTINE READF@ in the documentation of FTN95 myself before, but in order to further process the data read by that routine, I think I have to struggle with things like sign bits, mantissa and exponent position and lengths, exponent biases, inter-record bits or bytes, and so on. I really hoped I could avoid this by some way or other.
I reall cannot quite imagine that this problem should not have been
encountered (and probably solved) by hundreds or even thousands of Fortran enthusiasts who have changed from the IBM/Microsoft world to
Silverfrost/Salford Fortran.
With thanks in advance for any help,
Yours sincerely,
Wolfgang Höppner. |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Thu Aug 09, 2007 1:54 am Post subject: |
|
|
Wolfgang,
If I assume you are reading old binary files, from another computer and compiler, then you have the problem of understanding both the unformatted file structure ( bytes in header of the record ) and also the structure of the variables ( big and little indians !!! )
If you have access to the original program on the old computer, then by far the best would be to create a more system independent file structure. I would try to create a formatted file and read the text. There are all the problems of precision of the text format and others, but by far the biggest advantage is you can see the numbers in the dump file, using notepad or some other file viewer.
If you need to read these files as binary, then you need something like readf@ to read both the file structure ( 2 or 4 byte header, record and possibly trailer, if backspace is supported) and what the header means, as length can refer to characters, 2 byte integers or 4-byte reals. This is a common problem when mixing files from pre F77, F77 or F90+ compilers. There are a lot of variation on record header formats.
There are also transparent or fixed length file formats in fortran that can be useful.
You also need to know the structure of the data in the record, with mixing of integers, reals and their precision. I assume this is the case, or it just gets too hard. If the file came from a pc, then probably the mixing of real number formats between compilers will not be a problem.
Solve the header problem and hope for the best !
regards john |
|
Back to top |
|
|
|
|
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
|