Is this the function of a file format?

517 views

I have trouble understanding file formats, or maybe I have figured it out. Please help me!

A file format is a specification that tells how the data of a file is arranged and thus how it is to be interpreted. Does this mean, for instance, that data arranged according to a JPEG (an image format and codec) will tell my computer that the data is to be interpreted as an image?

In: 16

16 Answers

Anonymous 0 Comments

All files are just long strings of 1s and 0s.

You need to tell the computer what to do with those 1s and 0s. Should they be interpreted as a text file? Some sort of image? Maybe a sound file? Or a video? Or maybe as a program to be executed?

You can open a file meant to describe an image in a music player or a text editor but you will just get garbage.

When human write things down you can tell just from looking at what is written what the writing is supposed to be about. Is it a french poem, a recipe in Italian, as shopping list in English?

You can try to interpret a text that is a songs lyrics as washing instructions for your clothes washer, but it won’t really get you very far.

You won’t need to be told, you can tell by looking at it. If you get a letter written in a language you can’t read you can at least work towards getting help from someone who can read Chinese or Arabic to tell you what it is about and go from there.

Computers are not that flexible. You need to tell them exactly what you give them and what to do with it.

There are many ways to do that but the one you would use in for example Windows would be to add a a code at the end of the filename like “.txt” or “.jpeg” to let the operating system know what it is and what to do with it.

You can open basically any file on your computer with a hex-editor. This will give you access to the data in the file in its most raw format.

A text file will be readable almost right away, but other formats less so.

Often the beginning or files contain certain information about what type of file they are.

Many modern file formats are XML based (similar to the way the dat for this very website is arranged), this is not always the most efficient way to put data in a file but it makes it more human readable.

There are even some graphics formats like SVG that work like this and can be opened in a text editor to make sense of them.

Most of the time though file formats will only work for the program they are intended for.

You are viewing 1 out of 16 answers, click here to view all answers.