• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4022
  • Last Modified:

convert .bin to .txt

Hi,
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.
0
NevSoFly
Asked:
NevSoFly
  • 3
  • 2
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
What exactly is in your .bin file?  This isn't a standard file extension with a well known format...it could be anything!
0
 
NevSoFlyAuthor Commented:
I'm not sure what your asking me.  The file is simply a binary file used to keep log info.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
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:
http://filext.com/alphalist.php?extstart=%5EB

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?
0
 
NevSoFlyAuthor Commented:
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.  
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
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!

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now