Convert Binary File to ASCI File

Hello, I'm having a little trouble writing a labview program to read a binary file and save it to an ASCI file. The binary file may be large so I've tried to read the file in chunks. I will appreciate any help you could offer. I've attached my .vi below
thanks,
joe
Attachments:
BinToASCI.vi ‏45 KB

I don't really understand what you mean by "the data from the binary file are really huge numbers and don't match what is expected". Are you specifying the correct datatype to the Read function?
As far as your VI is concerned: Your initial statements indicated that you wanted to read this in chunks since you're dealing with very large files. However, while your VI reads in one number at a time, it writes out the whole thing in one big chunk. This is going to be a huge memory draw. You need to write the data to the ASCII file at the same time as when you read it, not after you've read it all. Given this, it makes no sense to only read one number at a time as you're doing. You're going to be performing a disk I/O operation for each number! This is going to take forever, not to mention take a nice bite out of the life expectancy of your hard drive. I don't say this often, but you need to restructure your VI to something like this:
1. Provide dialog to ask for the file to read.
2. Provide dialog to ask for the file to write to.
3. Write out your header to the output file.
4. Start a loop where the number of iterations is based on the number of times you have to read the file using a max chunk size. This is based on the file size and the size of the chunk that you're comfortable in reading. The chunk size is dependent on your machine - i.e., speed and amount of RAM.
5. Read that many numbers and write out the converted numbers.
6. Repeat until done.
7. Close both files.
See attached file as a starting point. The error handling is not that great, so keep that in mind.
Message Edited by smercurio_fc on 03-17-2006 05:20 PM
Attachments:
Read Chunks.vi ‏68 KB

Similar Messages

  • How to convert binary file to a particular format?

    Hi,
    I am having a requirement. I have in database various kinds of files stored as binary format. Its a sybase database. Now the files can be .pdf, or .doc also. But they are stored in binary format.
    I need to read the file from database.
    Now I can use jdbc to read the particular column value which contains the file in binary format.
    But tricky part is how to convert the binary file entry in a proper respective file format? So I have another column which basically has the value to tell the type of file. So I have ".doc" or ".pdf" as each entry of file...
    So please help me how can we do this using Java?
    THanks

    Hi,
    I am having a requirement. I have in database various
    kinds of files stored as binary format. Its a sybase
    database. Now the files can be .pdf, or .doc also.
    But they are stored in binary format.
    I need to read the file from database.
    Now I can use jdbc to read the particular column
    value which contains the file in binary format.
    But tricky part is how to convert the binary file
    entry in a proper respective file format? So I have
    another column which basically has the value to tell
    the type of file. So I have ".doc" or ".pdf" as each
    entry of file...
    So please help me how can we do this using Java?
    THanks

  • How to Convert binary file to s-records

    Hi all,
    can anybody help how to convert binary ".bin" files to s-record ".s" files
    any idea or code snippets are very appreciated
    best regards,
    gebi

    There is a ready-made converter: "BINARY to Motorola S-Record Conveter Utility" or BIN2MOT.
    http://www.keil.com/download/docs/bin2mot.zip.asp
    Other references:
    http://www.cs.net/lucid/moto.htm
    http://www.amelek.gda.pl/avr/uisp/srecord.htm
    http://www.seattlerobotics.org/encoder/jun99/dougl.html
    http://semmix.pl/mipc/specyf/filehex/mhexu.htm
    http://pmon.groupbsd.org/Info/srec.htm

  • How can I convert Binary File to Normal Text File?

    Hi,
    I need to read a binary file and need to conevrt as normal text file. The binary file contains some number & String (Names) with fixed length. It is the combination of Char, String, Integer, Byte & Single Bit.
    I used DataInputStream but I didnt get the expected output. Can anybody help me in reading a binary file?
    Thanks & Regards,
    Pattanaik.

    http://java.sun.com/docs/books/tutorial/essential/io/dataIO.html provides an example of using DataInputStream to do what you want.

  • Convert Binary file to PDF file

    Can I convert Binary data in to PDF format.
    If yes, show me a sample code.

    alokpotdar wrote:
    Can I convert Binary data in to PDF format.
    If yes, show me a sample code.Which method you are using to read binary data ?
    You can use iText for pdf
    http://www.lowagie.com/iText/
    Edited by: kanad on Aug 7, 2008 7:43 AM

  • Convert bin file into c++

    Hi, I have the problem described in subject. I am using psiconv but don't work as desired. I want to convert binary file into C or C++ file to be able to edit it and after editing put back into binary file for the router to work on the firmware binary file edited.

    thomastak,
    I am pretty sure that HalosGhost hit the mail on the head.  As to being against forum rules, I don;t really see a problem, provided this is for personal use and is not going to be redistributed.  But, disassembling code is a PITA, and you are not really able to get it into C -- especially not the original source.  It is just not how things work.
    The real question is, what is it that you are trying to do?   A better solution might be to go with open source router firmware to replace that which can with the router.  (OpenWRT, DD-WRT, etc...)
    https://en.wikipedia.org/wiki/List_of_w … e_projects

  • Convert Large Binary File to Large ASCI File

    Hello, I need some suggestions on how to convert a large binary file > 200MB to an ASCI File. I have a program that streams data to disk in binary format and now I would like to either add to my application or create a new app if necessary. Here is what I want to do:
    Open the Binary File
    Read a portion of the File into an array
    Convert the array to ASCI
    Save the array to a file
    Go back and read more binary data
    Convert the array to ASCI
    Append the array to the ASCI file
    Keep converting until the end of the binary file.
    I should say that the binary data is 32-bits and I do need to parse the data; bits 0-11, bits 12-23, and bits 31-28, but I can figure that out later. The problem I see is that the file will be very large, perhaps even greater than 1GB and I don't have a clue how to read a portion of the file and come back and read another portion and then stop at the end of the file. I hope to save the data in a spreadsheet.  If anyone has some experience with a similiar situation I'd appreciate any input or example code.
    Thanks,
    joe

    sle,
    In the future, please create a new thread for unrelated questions.  To answer your question, you can use "Split Number" from the Data Manipulation palette.
    Message Edited by jasonhill on 03-14-2006 03:46 PM
    Attachments:
    split number.PNG ‏2 KB

  • How can I convert the binary file content to XML message

    Dear friends,
    I poll the binary file from a ftp server but the payload only includes the binary content, no XML structure in the payload, I hope to convert the binary content to a element node within the XML structure, how can I do that? via content conversion?
    Thanks and regards,
    Bean

    Read the binary file stream using java I/O standard functions and convert the read stream to Base64 format. Now map this content to one of the field in target XML structure.
    You need a java mapping for this.
    what is your target system?
    Thanks,
    Gujjeti.
    Hi Gujjeti,
    Thanks a lot for your kind help, my target system is R/3.
    Can I achieve that with a UDF or a simple way?
    Regards,
    Bean

  • Sample code converting binary data to image file

    Hi experts ,
    I need sample code to convert binary data (bytes) in to an image file.
    any help will be appreciated.
    Thanks and Regards,
    Naresh

    You need to show binary and decimal?  Or now just decimal?
    If binary and decimal, you can right click on your indicator and choose "Display Format...".  If you select the Advanced Editing Mode, you can make soft interesting display formats.  This includes showing the same value in mulitple ways in the indicator.  Try something like "%032b - %d" for the format string.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to Convert Binary Data in Binary File

    hi,
    my telecom client puts a binary file which is asn.1 encoded with BER.
    how to handle binary data in java.
    how to convert binary to hexa to ascii format
    how to convert binary to octet to ascii format
    please help me in this.
    regards,
    s.mohamed asif

    You don't need to convert the data.
    Only you can do is print it in that formats, like it:
    public static String byteArrayToHex(byte[] b) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < b.length; i++)
             sb.append(Integer.toHexString(b&255) + " ");
    return sb.toString();
    take a look at this
    http://java.sun.com/docs/books/tutorial/essential/io/

  • How to convert PDF file into binary using APIs of Adobe Workflow server?

    I m using the Adobe Workflow Server 6.2. I want to write a web services to convert PDF file into binary and embed this binary data with XML.
    I want to use the APIs (or libraries) of Adobe Workflow server but dont know abt the APIs or Libraries that can convert the PDF file into binary format.
    I will be very thankful to u,if u can help me as i m n this prblm frm the last one week.I tried alot but could nt find the solution.
    waiting for a better response.

    check objectlibrary.pdf
    Dim o As New EPSDK.BinaryData
    o.LoadFromFile(sfilename)
    write o.Value to xml

  • 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.

  • Read binary file and convert to readable text

    I have a binary file which i want to read in and then convert it into readable text. How can i do this?

    I have a binary file which i want to read in and then
    convert it into readable text. How can i do this?Your question is a bit too vague to be answered. Here's an example -- suppose a file contains the bitstream 11011110101011011011111011101111. (just four bytes full of bits). If one 'converts' this bit stream using four byte big-endian integral values into a hexadecimal representation, the outcome would be 'deadbeef'. Using a little endian conversion, the outcome would be 'efbeadde'. All three text strings you're reading right now (the binary one, and both hexadecimal versions) are readable representations of the actual bitstream ... which one do you want?
    OTOH, if you want to know what's stored in a .class file (this is a Java forum isn't it?), have a look at 'pjava'; it comes with your SDK.
    kind regards,
    Jos

  • 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

  • DE PDP-1 binary file from Java

    Can someone here help me, please!?
    Anyone know how to convert a Java class file into a binary file that will run natively on my Digital PDP-1 computer? I just spent over $120,000 for it! Thanks.
    This resurrected thread was first posted November 25, 1960 at 8:25AM
    -------------------------------------------------------------------------

    This resurrected thread was first posted November 25,
    1960 at 8:25AMIn what time zone?

Maybe you are looking for

  • Report for Billing doc with payment status and tax details

    Hi All, I want the report for payment due billing documents with following fields and after payment is done( F-28 ) that document should not appear in the report for the said period. Billing date, Billing doc no, Net value, Tax Amount Thanks and rega

  • Datatypes for File to File Scenario

    Dear all, i have a question concerning a file to file to file scenario in XI. I simply just want so send a RTF-file to XI via FTP adapter and store it on a different FTP server according to the file name. I do not need any information for the content

  • SSIS package Corrupted - Connection element is not found - Visual Studio 2008

    Some body help me... last week my senior give me a SSIS package, but when I open in visual studio 2008 there is pop up like this. TITLE: Microsoft Visual Studio There were errors while the package was being loaded. The package might be corrupted. See

  • Can I disable the internal trackpad if I am using the magic trackpad

    I am using the magic trackpad with my 11" MacBook Air and want to disable the notebook trackpad. Is this possible. No obvious setting in the system trackpad  preferences.

  • Confused about Datagrams and security model

    Hi, I'm trying to write a java Applet that opens a port back to it's originating machine. I'm having a lot of problems. I've seen so much code out there that is so different and I've only been able to get some of it to work. My code currently works o