Reading a fortran file

This is a discussion on Reading a fortran file within the Windows Programming forums, part of the Platform Specific Boards category; OK, Hi, I have a file written in Fortran (77) as "unformated". Not only was it written in Fortran, but ...

  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, 02:04 PM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 01: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, 11:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21