![]() ![]() I urge you to obtain and read good textbooks and manuals regarding the subject, and work through several example programs in which you write and read unformatted Fortran files containing small amounts of data.įor instance, open an unformatted file for writing, write 9 integer values to it, and examine the bytes contained in the file using Emacs, a hex-file dumper, etc. It is your (unfounded) expectations of what Fortran unformatted files are, and how they are to be used. ![]() The problem is not really related to the files or the programs. Without knowing what the code did with those numbers what value would they be? If you are on GNU/Linux or Linux try running the “strings” command on the file and see if there are any strings in the file that give you information about it’s origin or type.Īlthough it is an interesting puzzle unless the format is exceeding simple (like as mentioned, a stream of float values, hopefully of a known size and endian) you would have to have a hugely compelling reason to even try and even if you succeeded it would just likely be a bunch of numbers. ![]() You know nothing about the file except it is a “Fortran” file? Some developers where thoughtful (or required to) and actually wrote the FORMAT statements used as strings into the files, but that is very rare in general. If you have the format statements that were used to write it it becomes far more plausible, especially if the file was written with just one format, or if you know the file is nothing but floating point values, etc. Knowing what platform the file was written on, what compiler was used, the vintage of the file, … almost anything can help but the short answer is no and to even attempt guessing is a non-trivial and somewhat unreliable process unless the file was written on a few very specific platforms, almost all of which have not existed for a long time. There are ways to detect patterns in the file and guess whether it is a sequential file or a direct access file, whether there are likely strings in the file, and what likely word size and endian the data was by assuming a likely range for values but it is not trivial and not foolproof. ![]()
0 Comments
Leave a Reply. |