convert .bin to .txt

Posted on 2007-07-21
Last Modified: 2008-01-09
I need a quick way to convert a binary file (.bin) to a text file.  I'm pretty sure this is easy but all the samples that I have seen only deminstrate how to convert a binary string to text.
Question by:NevSoFly
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    What exactly is in your .bin file?  This isn't a standard file extension with a well known could be anything!

    Author Comment

    I'm not sure what your asking me.  The file is simply a binary file used to keep log info.
    LVL 85

    Accepted Solution

    The term "binary file" is not clearly defined in the computing world.  In general terms, it means "not a directly readable text file".

    For example, with a .doc file, MS Word (or any program compatible with Word) can open that file and make meaning of it because there is a CLEAR definition of HOW the data inside the file is organized.  The internal file format is arranged in accordance with clear specifications concerning things like the order, size and quantity of data in the file.

    The address on the front of an envelope has a clear definition:

        Recipient on line 1
        Street address on line2
        City, State Zip on line 3

    A "binary file" could have any format to it...and therefore we don't know HOW to convert the data in it to a txt file because we have no idea how to read the data in it in a meaningful way.  Does every XXX bytes represent a number?  Does every YYYY bytes represent an ASCII character?  Does every ZZZ bytes represent a UniCode character?  What format are these bytes in?  Big Endian or Little Endian?  Are they Binary Coded Decimal?  etc. etc. etc....

    For instance, look up the "bin" extension at this website:

    There are multiple programs that use this extension...and those are only the "major" apps that have chosen this extension.  ANY app can write its data to a file with a .bin extension in whatever format it chooses.  There are no governing laws that dictate what extension an app can or can not use.

    Did you write this .bin file?  If not, where did it come from?

    Author Comment

    Thank you very much for the explination.  I did not write this file it is a company file written by some engineer many years ago and is still used today.  I am trying to automate a process by converting the file to txt and then reading the log info in it.  

    I now understand why I haven't been able to find sample code on the net.  
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    If you don't have any documentation on the format of this file then I'm afraid the best you can do is look at the source code that generated it to figure out the structure and logic behind it.

    If no source code is available, then sometimes you can give inputs to an app and see how it converts that to a .bin file.  Obviously this is not always possible...

    Finally, you can attempt to glean information from the file by inspecting it with a Hex Editor.

    Good luck!


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Article by: Kraeven
    Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now