1

How the following terms different in context of a file ?

Binary Form and Binary File.

skaffman
  • 398,947
  • 96
  • 818
  • 769
nuvo
  • 11
  • 1

3 Answers3

2

Well, all files are binary, but you can interpret their contents in various ways.

If you open a file in Notepad, and see the content:

Everything is good

Then you might think "this is a text file", but it is a text file only because you chose to open it in Notepad and Notepad was able to interpret the contents as characters and then display them to you and you could read it.

Binary Form might be a way to say that the data is not representable in a readable manner to us humans, for instance saving an image to a file certainly produces the same types of bits as a text file does, but you could not open the file in Notepad or similar and expect to understand any of it.

To conclude, whatever "Binary Form" and "Binary File" means probably depends on the context, but here's my interpretation:

  • Binary Form: Non-readable form, ie. not ordinary text, understandable only if you read it in through a computer program and render it
  • Binary File: A file containing data in binary form. All files are basically binary, consisting of 1's and 0's.

A text file is basically just a binary file that either carries with it something that identifies its contents as being of textual nature, or is by convention opened up in a program that will try to interpret it as text.

For instance, if a web server returns a file along with a mime type that identifies the file as text, the browser might try to display it to you, whereas if the server returns a mime type that identifies it as binary (ie. not text), the browser would usually just download the file without trying to display it.

So binary file is probably, in context of whatever it is that prompted your question, the conventions that differentiates the behavior of the programs that deals with files. As I said, all files are basically binary, it's how you interpret their content that is important.

Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825
1

All files are binary, but I might (for a given purpose) think of the data in binary form or in the form of the characters that it (if it contained text) represented. Hence one may consider the same file as containing "Hello World" or {0x48,0x65,0x6C,0x6C,0x6F,0x20,0x57,0x6F,0x72,0x6C,0x64} depending on what we were doing with it.

A file intended for use solely in the latter way (e.g. an executable or most image formats) would generally be referred to as a binary file.

Different conventions with text files can be sensibly converted between systems, for example, a transfer may translate between new lines being represented by {0x0A}, {0x0D}, {0x0D,0x0A} or {0x1E} (and a few other formats, but they have greater incompatibilities in other ways) so that the files worked correctly on whatever system they were moved to, however doing this to an image file or an executable will ruin it, hence we talk about transferring files as text (do the translation between line endings) or as binary (don't change anything).

Jon Hanna
  • 110,372
  • 10
  • 146
  • 251
0

One might say "binary form" to refer to some non-text representation of data. It's a very vague term. Likewise, a "binary file" is just a file that doesn't contain text.

Imagine you want to store the number "123" in a file. There are several ways you might do it, but broadly, there are just two: text or binary. In text form, the number "123" would be represented as a code for the digit "1", a code for the digit "2", and a code for the digit "3". There's nothing very different between this and a file continaing the string "abc": three codes for three characters.

But in a binary file, the number "123" would probably be stored as a single "code" -- the base-2 representation of the number itself. Not the characters we use to display the number, but the actual value of the number, if you understand what I mean.

Ernest Friedman-Hill
  • 80,601
  • 10
  • 150
  • 186