Page 1 of 1
Binary
Posted: Sun Mar 20, 2005 9:09 pm
by samjkd
what is a binary file and what's the use of it?
what is a windows binary file?
does linux have a binary file?
how can i create a binary file?
Re:Binary
Posted: Sun Mar 20, 2005 10:18 pm
by AR
A "binary" is usally a generic name for an executable. Binary = computer/machine language.
A "windows binary" is a Portable Executable (PE) format program that runs on Windows
A "linux binary" is an Executable and Linking Format (ELF) format program that runs on linux (Linux also supports COFF and a.out)
You create a binary by compiling and linking code using a compiler or assembler (Like GCC and LD)
Re:Binary
Posted: Mon Mar 21, 2005 12:09 pm
by mystran
While "binary" usually indeed refers to a program (and what AR said is correct in that sense), a "binary file" also often means basicly anything that isn't text.
If you are programming in (say) C, you might have noticed that you can open files in both "text" and "binary" mode. In Unix the difference is nil, since text and binary files work the same, but in Windows, opening a file as a text-file can affect the end-of-line conversion.
Depending on the meaning you are after, you can either create a binary file by compiling a program (in case of program binaries) or by simply writing some binary data into a file (binary datafiles).
Re:Binary
Posted: Tue Mar 22, 2005 8:55 am
by DevL
mystran wrote:
While "binary" usually indeed refers to a program (and what AR said is correct in that sense), a "binary file" also often means basicly anything that isn't text.
A JPEG image for example is an image stored in a binary format as opossed to an HTML document which is would be considered (in the Windows world, mind you) as a text file.
Re:Binary
Posted: Wed Mar 23, 2005 11:45 am
by ark
In the binary vs. text sense, all files are binary...text just means you look for certain characters (or strings) that indicate the end of the line.
From a practical standpoint, Windows ends a line of text with a carriage-return and line-feed pair. In binary mode, when you're reading the file you would see both the \r and the \n characters. In text mode, the \r\n pair is collapsed into a \n when you're reading it in (\n is similarly expanded to \r\n when writing it out). In a system like Unix where lines are terminated by a line-feed character only, there's no practical difference between the two.
Re:Binary
Posted: Thu Mar 24, 2005 1:17 am
by Solar
Gargl...
Do you open JPEGs in a text editor? Executables? Sound files? No.
But XML, HTML, text, config-files - those you open in a text editor. (At least occassionally.)
Re:Binary
Posted: Thu Mar 24, 2005 2:15 am
by distantvoices
Do *YOU* open text files in a mp3 player?
just take care of the *point de vue* and there is no problem with discussing it. I for one second joel. After all, a text file too keeps binary information. It just depends on who reads/interpretes the content. so *shrugs* 'n' peace.
Re:Binary
Posted: Thu Mar 24, 2005 4:14 am
by Solar
Everything on a computer is binary. Does that make XML, HTML, C source, Perl scripts and .txt files any less of a group that is called "text files" or "plain text files", to distinguish them from what is commonly called "binary" files (JPEG, WAV, MP3, MOV, EXE, ...)?
Come on, dudes. That kind of pointification isn't helping samjkd.
Re:Binary
Posted: Thu Mar 24, 2005 4:28 am
by distantvoices
for me, a binary is any file image. That's as it is.
The executing instance which takes the file and looks into its contents makes it be
a text file
a jpeg file
a mov file
... you get the hint.
I do not permit that global catch all definitions prevent /dev/brain from having its little grey wheels spin a bit to get the knack.
the most obvoius occurence of the meaning "binary" is when you download *hqx files with a browser in Linux (don't remember which one): it asks: "what shall i do with the file? a: filter it throu some conversion (decompressing etc) b: download it encoded c: download it as binary."
The knack is: shall the browser do some interpretation/conversion stuff to the downloaded image or shall it save the downloaded image to disk *as it is*
That's my explanation of "binary" vs "text". Now, Solar, it is your turn: better explanation? Other viewpoint?. Thanks btw for reminding me of the crucial manners of responding to the original question instead of bickering in the back.