How to read labview binary files in Matlab

I would like to read Labview binary files with Matlab. I read some articles of the subject and I am more interesting in know how labview store this data into file. What is the format use by Labview to store this data?
Any help is appreciated,
Hernando

The term "binary file" means that the data on disk is a (pretty close) duplication of the binary format of the data in memory.  For example, a String will appear as an array of Bytes that, if looked at with a text editor, would be "human-readable".  
An I32 or U32 integer would take 4 bytes, but the order (or "Endian setting") can be Big-Endian or Little -Endian (and I won't confuse both of us by trying to say which is which).  Thus the number "1" would appear as four byte of 0, 0, 0, 1 or 1, 0, 0, 0.  Floating point (Dbl) also has an "Endian" consideration, but the numbers are encoded as a mantissa and exponent, with sign appearing somewhere.  However, if you get the Endian and precision (Sgl, Dbl, etc.) right, both MatLab and LabVIEW should be able to read each other's data.
Be careful with Booleans.  It wouldn't hurt to do an experiment and see how many bits/bytes are used for simple Boolean data.
One other "gotcha" -- in LabVIEW, you can prepend Array and String writes with a U32 that is the length of the Array/String -- you obviously want to take this into account.
Something that I've found helpful when dealing (in both Matlab and LabVIEW) with "unknown" binary data files is to use an old-fashioned "binary editor", something capable of displaying a file as Text and Bytes.  Strings "stand out", and if they seem to be preceded with 4 bytes that are mostly 0 with one Byte more-or-less the length of the String (sign that String Length was prepended).  If you see a lot of byte data that look like they could be 2 or 4 byte integers, they probably are.  If they are four bytes of numeric data that have few zero bytes (i.e. if most of the 32 bits seem to be used), they may well be floats.  Make a guess at the format and write a short routine to read according to your guess -- do you get meaningful data?  Go ahead, be a Scientist, not an Engineer -- study the data, form a hypothesis, then design and do an Experiment and see if you need to reject your hypothesis ...
Bob (Neuroscientist) Schor

Similar Messages

  • How to read a binary file written in LabVIEW 6.1 using VB ?

    How to read a file saved in binay forrmat in LabVIEW 6.1 platform through VB.
    Is there any code ?
    Thanks

    Hello,
    LabVIEW files stored in binary can take on just about any format that
    you choose, so there will not be a single piece of code that will give
    you what you are looking for.  You can use VB's standard file
    operation functions to read in a binary file created by LabVIEW, just
    as you would read in any other binary file.  See this page
    on Microsoft's web site for more information on the binary file read
    operation.  How you stored the data in the binary file will
    determine how you need to extract it from the byte array.  So, if
    the first element stored in the file was a 32-bit integer, you could
    extract an int from the byte stream to recover that piece of your
    data.  You would need to know in advance how the file was
    formatted in order to successfully retrieve the information.  If
    you need a reference for the VB functions, the microsoft link above
    will get you to some good information.
    Cheers,
    Matt Pollock
    National Instruments

  • How to read excel binary file in ABAP application server

    Hi Gurus,
    I have to read business partner data from the binary format of an excel file in application server. I searched in forums but only found solutions about using ole2 objects, but in ABAP application server there is no excel APIs, so I have to read binary directly. You know it is rather difficult, do you have any clues or sample function modules? Thanks!
    Best regards,
    Hao

    Hi Deng,
    I think there are two possible solutions:
    1. Get the file created as tab-delimited or CSV as recommended earlier
    2. Excel files are BIFF (Binary Interchange File Format). The Microsoft office 97 developer kit has tools for analysis and access. You may search for existing interface software or create your own ABAP code. Publish it on SDN and win great merits.
    Regards,
    Clemens

  • How can I read a binary file stream with many data type, as with AcqKnowledge physio binary data file?

    I would like to read in and write physiological data files which were saved by BioPac�s AcqKnowledge 3.8.1 software, in conjunction with their MP150 acquisition system. To start with, I�d like to write a converter from different physiodata file format into the AcqKnowledge binary file format for version 3.5 � 3.7 (including 3.7.3). It will allow us to read different file format into an analysis package which can only read in file written by AcqKnowledge version 3.5 � 3.7 (including 3.7.3).
    I attempted to write a reader following the Application Note AS156 entitled �AcqKnowledge File Format for PC with Windows� (see http://biopac.com/AppNotes/ app156Fi
    leFormat/FileFormat.htm ). Note the link for the Mac File format is very instructive too - it is presented in a different style and might make sense to some people with C library like look (http://biopac.com/AppNotes/ app155macffmt/macff.htm).
    I guess the problem I had was that I could not manage to read all the different byte data stream with File.vi. This is easy in C but I did not get very far in LabView 7.0. Also, I was a little unsure which LabView data types correspond to int, char , short, long, double, byte, RGB and Rect. And, since it is for PC I am also assuming the data to be written as �little endian� integer, and thus I also used byte swap vi.
    Two samples *.acq binary files are attach to this post to the list. Demo.acq is for version 3.7-3.7.2, while SCR_EKGtest1b.acq was recorded and saved with AcqKnowledge 3.8.1, which version number is 41.
    I would be grateful if you someone could explain how to handle such binary file stream with LabView and send an example to i
    llustrate it.
    Many thanks in advance for your help.
    Donat-Pierre
    Attachments:
    Demo.acq ‏248 KB
    SCR_EKG_test1b.acq ‏97 KB

    The reading of double is also straight forward : just use a dble float wired to the type cast node, after inverting the string (indian conversion).
    See the attached example.
    The measure of skin thickness is based on OCT (optical coherent tomography = interferometry) : an optical fiber system send and received light emitted to/back from the skin at a few centimeter distance. A profile of skin structure is then computed from the optical signal.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Read_AK_time_info.vi.zip ‏9 KB

  • How can I read a binary file stream with many data type, as with AcqKnowled​ge physio binary data file?

    I would like to read in and write physiological data which was saved by Biopac�s AcqKnowledge 3.8.1 software, in conjunction with their MP150 acquisition system. To start with, I�d like to write a converter from different physiodata file format into the AcqKnowledge binary file format for version 3.5 � 3.7 (including 3.7.3). It will allow us to read different file format into an analysis package which can only read in file written by AcqKnowledge version 3.5 � 3.7 (including 3.7.3).
    I attempted to write a reader following the Application Note AS156 entitled �AcqKnowledge File Format for PC with Windows� (see http://biopac.com/AppNotes/app156FileFormat/FileFo​rmat.h
    tm ). Note the link for the Mac File format is very instructive too - it is presented in a different style and might make sense to some people with C library like look (http://biopac.com/AppNotes/app155macffmt/macff.ht​m) .
    I guess the problem I had was that I could not manage to read all the different byte data stream with File.vi. This is easy in C but I did not get very far in LabView 7.0. Also, because it is for PC I am assuming the data to be written as �little endian� integer, and thus I also used byte swap vi.
    I would be grateful if you someone could explain how to handle such binary file stream with LabView and send an example to illustrate it.
    Many thanks in advance for your help.
    Donat-Pierre

    One more step...
    short are U16 integer
    double are double precision float
    bool seem to be 2 bytes (= U16)
    char are string (variable length)
    rgb are U16 integer, with high order byte = 0
    rect should be 4 x U16 (top, left, bottom, right)
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • How can I read a binary file?

    In my AIR application, I'm trying to read a binary file and then post it via an HTTPService to a remote ColdFusion component that accepts a "binary" type argument.  The result of the post is always:
    The FILEOBJ argument passed to the addFile function is not of type binary.
    Here is how I'm reading the file in Flex, where fileObj is of type File:
    var fs : FileStream = new FileStream();
    var bytes : ByteArray = new ByteArray();
    fs.open(fileObj, FileMode.READ);
    fs.readBytes(bytes, 0, fs.bytesAvailable);
    fs.close();
    I then pass "bytes" as the parameter to my HTTPService's send call, like so:
    var params : Object = {method : "addFile", fileObject : bytes};
    service.send(params);
    When I debug, bytes contains the correct file size.  Is it not in binary form?  I've tried several other suggestions, but with the same result, so would appreciate any help.
    Thanks!

    One more step...
    short are U16 integer
    double are double precision float
    bool seem to be 2 bytes (= U16)
    char are string (variable length)
    rgb are U16 integer, with high order byte = 0
    rect should be 4 x U16 (top, left, bottom, right)
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • What's the best way for reading this binary file?

    I've written a program that acquires data from a DAQmx card and writes it on a binary file (attached file and picture). The data that I'm acquiring comes from 8 channels, at 2.5MS/s for, at least, 5 seconds. What's the best way of reading this binary file, knowing that:
    -I'll need it also on graphics (only after acquiring)
    -I also need to see these values and use them later in Matlab.
    I've tried the "Array to Spreadsheet String", but LabView goes out of memory (even if I don't use all of the 8 channels, but only 1).
    LabView 8.6
    Solved!
    Go to Solution.
    Attachments:
    AcquireWrite02.vi ‏15 KB
    myvi.jpg ‏55 KB

    But my real problem, at least now, is how can I divide the information to get not only one graphic but eight?
    I can read the file, but I get this (with only two channels):
    So what I tried was, using a for loop, saving 250 elements in different arrays and then writing it to the .txt file. But it doesn't come right... I used 250 because that's what I got from the graphic: at each 250 points it plots the other channel.
    Am I missing something here? How should I treat the information coming from the binary file, if not the way I'm doing?
    (attached are the .vi files I'm using to save in the .txt format)
    (EDITED. I just saw that I was dividing my graph's data in 4 just before plotting it... so It isn't 250 but 1000 elements for each channel... Still, the problem has not been solved)
    Message Edited by Danigno on 11-17-2008 08:47 AM
    Attachments:
    mygraph.jpg ‏280 KB
    Read Binary File and Save as txt - 2 channels - with SetFilePosition.vi ‏14 KB
    Read Binary File and Save as txt - with SetFilePosition_b_save2files_with_array.vi ‏14 KB

  • Read an avi file using "Read from binary file" vi

    My question is how to read an avi file using "Read from binary file" vi .
    My objective is to create a series of small avi files by using IMAQ AVI write frame with mpeg-4 codec of 2 second long (so 40 frames in each file with 20 fps ) and then send them one by one so as to create a stream of video. The image are grabbed from USB camera. If I read those frames using IMAQ AVI read frame then compression advantage would be lost so I want to read the whole file itself.
    I read the avi file using "Read from binary file" with unsigned 8 bit data format and then sent to remote end and save it and then display it, however it didnt work. I later found that if I read an image file using "Read from binary file" with unsigned 8 bit data format and save it in local computer itself , the format would be changed and it would be unrecognizable. Am I doing wrong by reading the file in unsined 8 bit integer format or should I have used any other data types.
    I am using Labview 8.5 and Labview vision development module and vision acquisition module 8.5
    Your help would be highly appreciated.
    Thank you.
    Solved!
    Go to Solution.
    Attachments:
    read avi file in other data format.JPG ‏26 KB

    Hello,
    Check out the (full) help message for "write to binary file"
    The "prepend array or string size" input defaults to true, so in your example the data written to the file will have array size information added at the beginning and your output file will be (four bytes) longer than your input file. Wire a False constant to "prepend array or string size" to prevent this happening.
    Rod.
    Message Edited by Rod on 10-14-2008 02:43 PM

  • Loading Labview Binary Data into Matlab

    This post explains the Labview binary data format. I couldn't find all of this information in any one place so this ought to help anyone in the future.  I didn't want to add any overhead in Labview so I did all of my conversion in Matlab.
    The Labview VI "Write to Binary File" writes data to a file in a linear format using Big Endian numbers of the type wired into the "Write to Binary File" VI. The array dimensions are listed before the actual array data. 
    fid = fopen('BinaryData.bin','r','ieee-be'); % Open the binary file
    Dim1 = fread(fid,4); % Reads the first dimension
    Dim2 = fread(fid,4); % Reads the second dimension
    Dim3 = ...
    Each dimension's length is specified by 4 bytes. Each increment of the first, second, third, and fourth byte represent 2^32, 2^16, 2^8, and 1 respectively. 0 0 2 38 equates to 2*256 + 38 = 550 values for that particular dimension.
    As long as you know the number of dimensions and precision of your binary data you can load it.
    Data = fread(fid,prod([Dim1 Dim2 Dim3]),'double',0,'ieee-be'); % Load double precision data
    If you have appended multiple arrays to the same file in Labview you would repeat this procedure. Load each dimension then load the data, repeat.
    Data = fread(fid,prod([Dim1 Dim2 Dim3]),'int8',0,'ieee-be'); % Load int8 precision data or boolean data
    I had to create a function for my own purposes so I thought I'd share it with everyone else too.  I uploaded it to the Matlab File Exchange.  The file is named labviewload.m.
    This was tested on Matlab R2007a and Labview 8.2.

    Thanks. I have the same questions as I tried to load labview binary data into Matlab. 
    -John

  • "Read From Binary File" function Help ambiguity

    I must be getting tired, but for some reason a doubt crept in my mind as I was designing a new piece of code this morning:
    "is the "Read From Binary File" using the last file position or is it starting from the beginning of the file?"
    "That's a stupid question", I told myself.
    "I used this function a million times and have always assumed it is reusing the last file position. Moreover, there is no file offset input to that function, so WTH am I afraid of?"
    So, for kicks, I fired up the Help window and read the following description (*):
    Reads binary data from a file and returns it in data. How the data is read depends on the format of the specified file. This function does not work for files inside an LLB.
    (*) BTW, has anybody ever complained that you can't select and copy anything from the floating Help Window?
    Not much there. I particularly admire the phrasing of the second sentence... What about: "This function can do a lot of things, but it would much to complex to describe this is extensive details, so if you are asking, you probably can't afford using it"?
    Anyhow, I clicked on the "Detailed Help" and got this (among other things):
    Use the Set File Position function if you need to perform random access.
    WHAT? I am pretty darn sure I DO NOT USE the Set File Position when I read a file in successive and contiguous chunks. I just pass the file refnum into a shift register and back to the function and that's it.
    Now, the description of the "Refnum Out" ouput says: If file is a refnum or if you wire refnum out to another function, LabVIEW assumes that the file is still in use until you close it. Translated in plain English, is that supposed to mean that if the file is not closed it is open, or is that implying that it contains more info that just "the file is open and can be found here"?
    I started searching around and finally ended up with the entry for "refnums, file I/O". Down the bottom of the (long) article, I found this under the heading "References to Objects or Applications" (but nothing specific to files, BTW):
    ...LabVIEW creates a refnum associated with that file, device, or network connection...
    [...]  LabVIEW remembers information associated with each refnum, such as the current location for reading from or writing to the object and the degree of user access, so you can perform concurrent but independent operations on a single object. If a VI opens an object multiple times, each open operation returns a different refnum. LabVIEW automatically closes refnums for you when a VI finishes running, but it is a good programming practice to close refnums as soon as you are finished with them to most efficiently use memory and other resources.
    So it seems that my recollection was correct. I do not know what the "degree of user access" for a file is, but that's not the topic of today's post. 
    So, my point is: the Help File for this function is incomplete or ambiguous at best. Please correct it. And provide a link to the "refnum, file I/O" Help entry in its detailed Help. It would H E L P...
    Thanks for reading.

    Reading in succesive chunks is *NOT* random access. An open file always has
    a current position, which is updated with each read or write operation.
    You only need to set the file position if you want to start elsewhere.
    LabVIEW Champion . Do more with less code and in less time .

  • "Read from Binary File" and efficiency

    For the first time I have tried using Read from Binary File on sizable data files, and I'm seeing some real performance problems. To prevent possible data loss, I write data as I receive them from DAQ, 10 times per second. What I write is a 2-D array of double, 1000 data points x 2-4 channels. When reading in the file, I wish I could read it as a 3-D array, all at once. That doesn't seem supported, so I repeatedly do reads of 2-D array, and use a shift register with Build Array to assemble the 3-D array that I really need. But it's incredibly slow! It seems that I can only read a few hundred of these 2-D items per second.
    It also occurred to me that the Build Array being used in a shift register to keep adding on to the array, could be a quadratic-time operation depending on how it is implemented. Continually and repeatedly allocating bigger and bigger chunks of memory, and copying the growing array at every step.
    So I'm looking for suggestions on how to efficiently store, efficiently read, and efficiently reassemble my data into the 3-D array that I need. Perhaps I could simplify life if I had  "write raw data" and "read raw data" operations that write and read only the numbers and no metadata.then I could write the file and read it back in any size chunks I please -- and read it with other programs besides. But I don't see them in the menus.
    Suggestions?
    Ken
    Solved!
    Go to Solution.

    I quote the detailed help from Read from Binary File:
    data type sets the type of data the function uses to read from
    the binary file. The function interprets the data starting at the current file
    position to be count instances of data type.
    If the type is an array, string, or cluster containing an array or string, the
    function assumes that each instance of that data type contains size information.
    If an instance does not include size information, the function misinterprets the
    data. If LabVIEW determines that the data does not match the type, it sets data
    to the default for the specified type and returns an error.
    So I see how I could write data without any array metadata by turning off "prepend array or string size information", but I don't see any way to read it back in such bare form. If I did, I'd have to tell it how long an array to read, and I don't see where to do that. If I could overcome this, I could indeed read in much larger chunks.
    I'll try the auto-indexing tunnel anyway. I didn't tell you the whole truth, the 3-D array is actually further sliced up based on metadata that I carry, and ends up as a 4-D array of "runs". But I can do that after the fact instead of trying to do it with shift registers as I'm reading.
    Thanks,
    Ken

  • How to convert proprietary binary file

    Hi All,
    I've got a problem that i can only tell you a little about due to the fact that i've signed a non-disclosure agreement which prevents me from telling you all the information that i have. I know my way around LV reasonably well but have no experience of programming C or C++. I have a data capture device that saves files in a properitary binary format.
    I've got partially there - i have a Read From Binary File.vi working to read in a string. I then typecast this to U8 and hey presto i get out most of the data that i am looking for. The problem is that there is a mix of ints, chars, and others and i don't have access to that data (which is what i want).
    The manufacturer has given me a bit of code that explains the file format, but the problem is that i cannot quite understand it (nor can i post it). However, it goes something like this:
    #define blah blah
    struct blah blah
          union
                  unsigned char blah;
                  struct
                           unsigned char blah     :1;
                           unsigned char blah     :3;
                           unsigned char blah     :2;
                  }    blah;
           }blah;
          unsigned char blah;
          double blah;
          int blah;
          int blah;
    Blah stand for various variables.
    Could someone have a stab at explaining what is going on. I am guessing that if i use some sort of cluster (=struct??) then i might be able to get the info that i need.
    Thanks.
    Phil

    Easy part out of the way first: You do not need to read the file into a string and then typecast to a U8. You can simply read as a byte array by just doing this:
    OK. Next part. What's probably stumbling you is the use of struct and union. Yes, a struct is basically a cluster. A structure is an ordered set of items. Each member is located in memory one after the other (I'm ignoring memory alignment here for the sake of illustration). A union, on the other hand describes an object in which all of the members start at the same memory location. However, only one member is actually present in terms of value. The amount of storage is the size of the largest member. In the example you provided what's being described is the following (again, ignoring memory alignment considerations here for the sake of illustration):
    "something" that is 3 bytes long (since the struct member is longer than the single unsigned char)
    a 1 byte unsigned char
    a double (8 bytes - most likely)
    an int (4 bytes - most likely)
    an int (4 bytes - most likely)
    The "something" is the union, and it can be represent either a single 1 byte value (with the other 2 bytes being meaningless), or a structure of 3 separate 1 byte values. Which one it is depends on the variable values that were written to file, so you need to know something about what was written. 
    Now I said that I was ignoring memory alignment issues for illustration. Well, you can't.  This just means that the amount of memory used will be larger than a simple addition of the size of each datatype. Let's take a simple example:
    struct y {
       char a;
       short b;
       char c;
    How many bytes is y? The direct addition would tell you 4 (1 + 2 + 1). However, the more likely answer is 6 since memory alignment consideration dictate that you need to start on an "even" memory address. A C compiler will tell you the correct answer because this is platform dependent.
    So what does all this mean to you? Well, my suggestion is that you write a wrapper DLL to convert the file since you will be able to cast the data you read from file directly into a variable of the type of the overall struct. Trying to deal with this in LabVIEW is probably not worth the effort.
    Caveat: I'm no C expert, so I hope that I didn't say anything that was outrageously wrong. If I did, someone please correct me!
    Message Edited by smercurio_fc on 11-07-2008 10:00 AM
    Attachments:
    Example_VI_BD.png ‏1 KB

  • Issue in reading a binary file, with 'Flatten to String' data.

    I'm facing issue while reading a binary file (created using LabVIEW).
    I've mentioned everything (issue and method to reproduce it) within the attached VI.
    Same vi is attached in 2012 and 8.0 versions.
    Regards
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.
    Solved!
    Go to Solution.
    Attachments:
    Issue in VI.vi ‏26 KB
    Issue in VI (Version 8.0).vi ‏43 KB

    moderator1983 wrote:
    crossrulz wrote:
    The reading of a string from a binary file stops at a NULL character (0x00).  When the first character is 0x00, you are just reading the one character.  I would suggest writing to a byte array since you are doing the inverting.  And then you can read as a byte array.
    crossrulz:
    U rocks..!!
    you have hit bull's eye...!!
    After playing around a little more, I think I might have misinformed you a little.  If you explicitly tell it a string, it looks for the string length at the very beginning and reads that length of bytes as a string.  It appears that if you implicitly tell it to read a string (not wire the data type) it reads all of the bytes directly, including the length of string you wrote.
    Regardless, my advice is the same.  You should just write and read using byte array.  It is less conversions if you are performing your "encryption".
    EDIT:  Here's a snippet of the VI I was playing with to figure this out.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    String Binary File.png ‏12 KB

  • Read From Binary File doesn´t work on MCB2400 in LV2009 Embedded ARM

    Hello,
    I try to read a Binary File from SD-Card on my MCB2400 Board with LV2009 Embedded for ARM.
    But the output is always 0, if I use my VI on the MCB2400. If use the same VI on the PC it works fine with the same binary file.
    The
    access to the SD-Card on the MCB2400 works in other cases finde, if I
    try to read from a text-file it works without any problems.
    Are thre any constraints for the "Read From Binary File"-Node in Embedded in comparison to the same node on PC ?
      I have noticed that there is also a problem
    with the reading of textfiles. If the sice of the file is about 100Byte
    it doesn´t work anymore, too. I can´t understand it, because I read
    always just one Byte. And even if the implementation in Labview is so
    bad that it allways reads the total file in the ram it sould work. The
    MCB2400 has 32MegaByte RAM, so 100Byte or even a few MegaByte should
    work.
    But this doesn´t seem to be the Problem for the Binary-Problem. Because even a 50byte Binary-File doesn´t work.
    bye & thanks
    amin
    Solved!
    Go to Solution.
    Attachments:
    SD_Card_Read-test.vi ‏12 KB

    Hello,
    thank you for your Help.
    But I just want to read a Binary File, which is build by another program. And this is coded with 8Bit (like a normal Binary File) and not just with 7Bit (ASCII). So the workaround doesn't work in my case.
    I posted the Test-VI in my first post (here once again as picture). And it works fine on the PC, but if I try it on my MCB2400 the "Read Form Binary File" Node doesn't work.
    And it is also possible to open the Bin file with the "Read Text File" Node and see the cryptic content of the Bin-File. So the Problem seems to be in the "Read Form Binary File" Node.
    bye & thanks again
    amin
    Message Edited by aminat on 09-30-2009 03:28 AM

  • Reading a binary file (byte swapping?): HELP!

    Hi,
    Below are 2 simple programs, one in C and the other in Java that read a binary file. The first 3 integer numbers read by the C program are:
    910, 1024437292, 100002
    The first 3 integer numbers read by the Java program are:
    -1912406016, 749473597, -1568276224
    The file was written with another C program. The values read by the C program listed here are correct.
    I supect that I have a byte swapping problem. Do you know how I can solve this problem? I really can't change the format of the input file.
    Thanks for your help,
    Miguel
    #include <stdio.h>
    void main(int argc, char *argv[]) {
    long buff[600];
    FILE *fp = fopen("c:\\inetpub\\wwwroot\\super\\wvdot3.awg","r");
    fread(buff,sizeof(int),512,fp);
    int sz = sizeof(int);
    import java.io.*;
    public class test {
    public static void main(String[] args) {
    try {
    DataInputStream din = new DataInputStream(new BufferedInputStream
    (new FileInputStream("c:\\inetpub\\wwwroot\\super\\wvdot3.awg")));
    int nrecs = din.readInt();
    int version = din.readInt();
    int routetype = din.readInt();
    System.out.println("read: " + nrecs + " " + version + " " + routetype);
    } catch (IOException exc) {
    System.out.println("IOException: " + exc);

    Yeah, the problem is byte ordering. I had to deal with the same thing, since Java is always big endian, and intel and DEC Alpha are both little endian. I assume you're original program runs on Intel.
    I ended up creating a new LittleEndianDataInputStream. Unfortunately, you can't just extend DataInputStream since all it's methods are final. You can however copy the source, rename it, and then change all the multi-byte numeric methods to reverse the byte ordering.
    For example, here is the code for the original and little endian version of readInt()
    <code>
    // DataInputStream
    public final int readInt() throws IOException {
    InputStream in = this.in;
    int ch1 = in.read();
    int ch2 = in.read();
    int ch3 = in.read();
    int ch4 = in.read();
    if ((ch1 | ch2 | ch3 | ch4) < 0)
    throw new EOFException();
    return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));
    // LittleEndianDataInputStream
    public int readInt() throws IOException
    int ch1 = in.read();
    int ch2 = in.read();
    int ch3 = in.read();
    int ch4 = in.read();
    if ((ch1 | ch2 | ch3 | ch4) < 0)
    throw new EOFException();
    // here's the change
    return ( (ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0) );
    </code>

Maybe you are looking for

  • Help Itunes wont see Iphone yet windows sees it fine :s

    Help my iphone wont show in itunes have tried all the suggested things but hasnt worked and having uninstalled and reinstalled itunes latest version about 8 times now im getting a bit tired of it. Was running fine then i removed some old nokia phone

  • HOW DO I ENCRYPT A PDF DOCUMENT

    I AM TRYING TO FIGURE OUT HOW TO ENCRYPT A PDF FILE.  I HAVE THE PDF PACK AND ADOBE DOCUMENT SOLUTIONS.  I LOOKED UNDER THE TOOLS TAB AND SECURITY TABS AND I STILL CAN'T FIND AN OPTION TO ENCRYPT THE DOCUMENT

  • Problem encountere​d in inserting tree items

    Hello All. I am encountering problem in inserting tree items in a parent child recurring manner. My requirement is that everytime i presses the button, one parent should be inserted in the tree along with its child. Its output should be just like Fau

  • HT4889 Migration

    Which is the fastest method of migrating from my iMac to my new MacBook pro?

  • Disk utilities problem

    I have the original starcraft and brood war cds in my possession. However, for convience, I wanted to create a .dmg or .iso file for the cds so I don't have to bring them with me to college. I was able to create a .dmg file for the starcraft cd. But,