Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the file extension when creating Binary files

Tags:

c#

I am just trying to learn to write to Binary files. When we create text files we normally give the extension .txt. The same way, what should be the file extension for Binary files created using C#.

Which are the contexts that demands us to write to a binary file. What is the benefit in writing/creating a binary file rather than a text file when processing data?

like image 875
Unnikrishnan Avatar asked Oct 18 '16 02:10

Unnikrishnan


People also ask

What is the extension of binary file in Python?

BIN and . DAT are the most popular extensions for "raw" binary file formats.

Is .DAT a binary file?

A DAT file is a generic data file created by a specific application. It may contain data in binary or text format. DAT files are typically accessed only by the application that created them.

How binary file is created?

Until the end of the text file is reached perform the following steps: Read a line from the input text file, into 3 variables using fscanf(). The structure variable is set to values for elements(to write the structure variable into the output file. Write that structure variable to the output binary file using fwrite().

What is binary file extension on Linux?

bin file is a self-extracting binary file for Linux and Unix-like operating systems. Bin files often used for distributing executable files for program installations. The . bin extension is most commonly associated with compressed binary files.


2 Answers

Absolutely anything you want, or even nothing at all.

Just make sure you're consistent, and it helps not to use an extension already in wide use such as .doc or .pdf

Microsoft once advised using long extensions of the form .company-program-format [1] since you can have extensions longer than 3 characters now, but this never took off to gain wide acceptance in the industry.

1: Footnote: I cannot find a source for this claim but I remember reading it on MSDN around the time Windows Vista came out. You see it in Windows OS files like dvr-ms. These former guidelines are alluded to in this page, but the it's link is now broken and points to a totally different page: https://msdn.microsoft.com/en-gb/library/windows/desktop/cc144156(v=vs.85).aspx#short_and_long

like image 191
Dai Avatar answered Sep 26 '22 17:09

Dai


From my experience, .BIN and .DAT are the most popular extensions for "raw" binary file formats.

But it's just a general convention, you are not limited to follow it in your own projects.

like image 29
gotzmann Avatar answered Sep 25 '22 17:09

gotzmann