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

Similar Messages

  • How to convert .tod extension files

    how to convert .tod extension files for use in final cut pro

    DLewis from rocklin wrote:
    Unfortunately you can not convert .TOD file extensions for Final Cut Pro to use.  The .TOD is something proprietary that JVC used a few years ago.  The best thing to use is MPEG Streamclip and convert the .TOD files to a Quicktime file using the AIC codec from the convert settings in the MPEG Streamclip program. 
    Good advice, except for the AIC codec part. The native codec for FCP X is ProRes. Use ProRes 422.
    (AIC was used by FCE and is still used by iMovie; while you can use it with FCP X, it is not the preferred codec).

  • Converting .bin (Binary) File to .bmp ( BMP ) File

    Hi All,
    I have a requirement to convert .bin file to .bmp file. The binary file is generated by the video frames and now i want to convert this binary file into the .bmp file. Can anybody help me how to do this and if possible then pls write the sample code.
    -Thanks

    How do you meen generated by the video frames?
    Do you mean that the .bin file is created by an application in the event of a screen shot fo example?
    If so then the big question is in what format did this application save the image data
    Please elaborate.
    Don't bank on the idea of us giving you code,
    we will if possible point you into the right direction and help where required but thats about as far as we prefer to go.

  • How to convert the javasource file(*.class) to execute file(*.exe)?

    How to convert the javasource file(*.class) to execute file(*.exe)?
    thank you!

    Although i have seen a few programs (that are platform specific) that will embed a small jvm into an exe with your class file, it is generally excepted that you cannot create an executable file using java. The JAR executable file is probably the closest your going to get
    Pete

  • How to convert java class file version without decompiling

    Hi,
    Oracle R12.1.3 i am having illegal access error while try to access the class file version Java 1.3 uses major version 47,So how to convert the class file version without using decompiling.
    Current java version is 1.6.0_07
    Is there any tool or API for converting class file version?
    Thanks,
    Selvapandian T

    Beside this I wonder where you get your error from since AFAIK 12c comes with java 1.6.
    Well wonder no more!
    OP isn't using Oracle 12c database.
    They are using Oracle R12.1.3 - which is the E- Business Suite.

  • How to convert a class file to exe file and how to cteate a class file to d

    how to convert a class file to exe file

    Hi Bhaskarq,
    Hi,
    It is not at all possible.
    But it is a really worst method.
    Please go through it.
    This is a very common question asked in the comp.lang.java newsgroup. Its often useful to have an
    executable application when deploying your
    applications to a specific platform, but remember to
    make your .class files available for users running
    Unix/Macintosh/other platforms.
    Microsoft provide a free system development kit (SDK),
    for Java, which includes the jexegen tool. This
    will convert class files into a .EXE form. The only
    disadvantage is that users need a Microsoft Java
    Virtual Machine (JVM) installed. If your target
    platform is Win32, you can either redistribute the
    virtual
    machine, or raise the level of your system
    requirements, to include Windows 98, or Windows 95
    with
    Internet Explorer 4. Systems matching these
    requirements will already have a copy of the Microsoft
    Java Virtual Machine installed.
    Note : You must specify all of the class files your
    application needs (except for standard java packges)
    as a parameter, so if you have third party libraries,
    you'll need to include them as well. You can use wildcards * though, and you don't need the original source code.
    Also please see this Forum which will give a good idea
    http://forum.java.sun.com/thread.jsp?forum=31&thread=149733
    I hope this will help you.
    Thanks
    Bakrudeen
    Technical Support Engineer
    Sun MicroSystems Inc, India

  • Does anyone know how to convert an XML file to a readable file?

    All,
    I have been using an APP called "SMS Backup & Restore" to backup my message conversations to my Laptop PC.  It works fine BUT the backup file, once in my PC, has an XML extent such as "filename.XML"
    I would like to read and/or print and/or save the text message file so does anyone know how to convert the XML file to something else so it shows all the messages without all the formatting instructions.   
    When I try to see the XML file it shows all the formatting.  If I replace the .XML with .TXT that too shows all the formatting mixed in with the text message narrative.
    When I look at the XML file in SMS Backup & Restore in the Charge phone it looks great showing all the messages just as they were on the phones display.  The problem with this is that there is no way to print or read or save the messages as they appear in the file from the phone itself.  I tried screen capture but if you have, let's say, a 28 message conversation you have to do 7 or 8 screen captures to get them all.
    If only I could convert the XML in my PC to something that is printable or savable or readable that would be the "cats meow."
    Anyone know how???
    JerryF
    PS, You might take a look at my related post.
    https://community.verizonwireless.com/message/809832#809832

    Ann154,
    You were correct again.  I deleted everything I had done to date and re-did the entire SMS backup of my 28 message conversation again and YES I was able to open it using IE-8.  It looks great and it prints great and life is good!  I am going to go make a donation.
    Thanks again for the help.  I marked this thread as answered by you.
    JerryF

  • How to convert a pdf file with hand-written signature?

    How to convert a pdf file with hand-written signature?

    Hi Lotus1215,
    Once the document is signed we cannot edit that document, hence convertion is not possible
    Please see the article mentioned below
    http://forums.adobe.com/docs/DOC-1515
    Let me know if you have any other question.
    Regards,
    ~Pranav

  • How to convert a PDF file into a full editable WORD file?

    Hi,
    I tried to convert a pdf file into word but it is not fully editable. I can edit the title from the main page and that's it. The rest of the word document is saved as image. I tried editing teh pdf file but that one is not working either.
    Please help on how to convert a PDF file into a full editable WORD file.
    Thank you

    Not all PDF files are created equal.  When a PDF file is created with Adobe Tools it is usually "tagged" with information about the fonts the images, the layout etc...    This way when the PDF is saved to a new format like PPT or DOC then the results are usually usable.  However, if you have a PDF file that was not tagged for some reason then run the Accessibility tools on the PDF to acquire some basic tagging.  This may get you a better result.  Also if you have a PDF that is an image, then you may want to run OCR on it.

  • HOW TO CONVERT A XML FILE TO HTML FILE FORMAT IN WINDOWS APPLICATION

    Hi iam a fresher iam working on a project in that i should convert the data in xml file to html file. I dont have any idea regarding this can anyone help me how to convert the xml file to a html file format. I just written the code till how to read the xml
    file. Now i stucked how to write the code for converting to html format.
    Thanks and Regards,
    Dileep.

    Hi iam a fresher iam working on a project in that i should convert the data in xml file to html file. I dont have any idea regarding this can anyone help me how to convert the xml file to a html file format. I just written the code till how to read the xml
    file. Now i stucked how to write the code for converting to html format.
    Thanks and Regards,
    Dileep.
    Hello,
    For converting xml file to html, we could refer to the way shared in the following thread which uses an XSLT stylesheet to transform the XML into another format using the
    XslTransform class.
    http://www.codeproject.com/Articles/12047/How-to-Convert-XML-Files-to-HTML
    Regards.
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to convert an ascii file into dBase .dbf file type

    Does any one out there know how to convert an ascii file(which is generated from PL/SQL script) into a .dbf (dBaseIII) file type? Thanks in advance.

    I haven't worked with dBase for about 20 years, but I seem to recall it having an IMPORT command for that purpose. But maybe I'm wrong...

  • How to convert a Excel file to a text file

    Hi,
    Anyone knows how to convert a excel file to a test file in java.
    Thanks
    John

    hi
    The question is not easy to respond. The easy way is to use the excel program itself! You can read the contents of an excel file using jdbc. Have a look at javaworld for an introduction (�It�s Excel-lent�). Another approach is to use a native library like JExcelApi. Have a look at http://www.andykhan.com/jexcelapi/index.html
    best regards
    benny

  • Hi how to convert Indesign CS5 file to Indesign CS4 version

    Hi Iam Rajesh
    Hi how to convert Indesign CS5 file to Indesign CS4 version, please tell me
    thanks
    best regards
    Rajesh

    Try this:
    http://ajarproductions.com/pages/products/in5/
    Bob

  • How to convert a .alsx file into pdf

    How to convert a .alsx file into pdf
    Iam facing this problem since many days please resolve it
    http://www.roothow.com
    Thankls in adavance

    >But, from the windows explorer, if i do a right clic on the word document, with the context menu, i can directly convert to PDF
    This is equivalent to using the PDFMaker facility in Word - that is,
    the Acrobat button. Which is also the same thing that is done when you
    use File > Create PDF > From File in Acrobat.
    What it does is print to a PS file *and* do a lot of additional
    processing to write stuff about links, tags etc. into the PS file.
    >(no tmp PS file is used, cause the links are still working).
    This isn't true, but it's certainly the case that you won't get links.
    There seems to be no API, via any mechanism, still less the "obsolete"
    (Microsoft's view) command line, to use PDFMaker from your program.
    Aandi Inston

  • Howe to convert i tune files into MP or WAC files

    Howe to convert I Tune files into MP3 or WAV files

    iTunes should be able to do everything for you, however if you wish to use third party software that requires MP3 or WAV files, iTunes can convert to either of those formats from any format it can read.

Maybe you are looking for