1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Rep Power

    Binary File. Extract float data from binary file and put into array


    I have a binary file that contains floating point numbers and is in little endian (this last part I don't think is very important). I would like to read the numbers from this file and and put them into an array.

    I have done some research and I cannot figure out how to do this. I know that there are InputStream, FileInputStream, DataInputStream, and BinaryInputStream classes that have the methods that will get this done, but I have not been successful at anything. I know that FileInputStream takes a file as its constructor and that DataInputStream has readFloat().

    Does anyone know of code on the Internet that already does this? Or can anyone help me out with advice, guidance, code, etc.?

    Thanks all,
  2. #2
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Eastern Florida
    Rep Power
    What do you mean when you say the file contains floating point numbers?
    Can you look at the contents of the file with a hex editor and post the first 8 bytes of the file here in hex?

    How was the file created? Have you tried the DataInputStream class readFloat() method?

IMN logo majestic logo threadwatch logo seochat tools logo