Thread: Reading a fortran file

  1. #1
    Unregistered
    Guest

    Thumbs down Reading a fortran file

    OK, Hi,

    I have a file written in Fortran (77) as "unformated".
    Not only was it written in Fortran, but on a unix system.
    I am now trying to read in the doubles out of the file in MS VC++.
    I know the byte size of each (both 8 luckily), and I think I know where all the buffering etc is, so I'm pretty sure I know the exact eight bytes to take out of the file to get my double.
    But when I look at the result, it's nothing like the number I'm expecting. I think this might be to do with bifferent bits (eg for sign, mantissa...) being in different places in the 8 bytes, but I'm not sure, and don't know what to do if it is.

    Please help,

    Phil.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Maybe the bytes are swapped on the unix machine. So byte 1 should be byte 8, byte 2 should be byte 7, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  4. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM