Is this the function of a file format?

519 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

>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?

No.
Your computer has no idea what format the data actually is. The extension (.mp3, .txt, etc) is the thing that tells your computer what the data is.
You can immediately see this by renaming the extension of a say an .mp3 files as a .txt.
The computer will immediately try reading it as a .txt files, and produces utter gibberish as a result.
So there is no way for the file format itself to tell the computer how to read it, other than a convention to name files a certain way.

You are correct, that once the computer is directed to use a compatible program, it will work, because the file maker program and the file reader program share an idea of what way the files should be.

Think of a file format more like a form.
So imagine it like saying
“Last Name 10 letters, First Name 10 letters, Occupation 10 letters”

The file might look like
“Smith00000John000000Plumber00”

So if you got the right program to access it, it would read A Plumber named John Smith.

Use the wrong program… say one that’s expecting
“Occupation 15 letters, Last Name 15 letters, First Name 15 letters”

And it would tell you there’s someone named 0000Plumber00 who works as a Smith00000John.

Some formats are complicated enough that a wrong format is enough to break everything, so those will tell you the format is corrupted.

EDIT:
OK I think I see the problem here.
There are two groups of people here. Those that see the OS and Applications as two very different things, and those who don’t make that distinction.

If you see the OS as a different, you know that files are just a sequence of bytes and it’s up to the program to figure out what those bytes mean. So the OS has no idea what the file contents really mean, it just hands it off to a program that it thinks should (guided by the file extension), or serves up whatever file a program ask for.
So from that perspective, the OS doesn’t know anything about file formats.

If you don’t see a difference, then you know that some programs have ways of detecting if a file is a format they were specifically designed to read. In addition, some programs which are designed to handle multiple formats can recognize certain features in a file and can thus figure out what format it is.
So they think that the contents of the file matter.

However I would like to immediately point out that some programs (such as basic text editors) have a such a broad range, that they’ll be able to read something from nearly any file, regardless of format, because nothing in the chain from drive to screen actually knows anything about file formats. So despite it displaying gibberish, it still shows something.

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