Pergunta

Is a computer file just a string of zeroes and ones? If so, can it start with zeroes?

I have not been able to find an answer, surprisingly.

Foi útil?

Solução

Yes the File has a binary representation and it can start with a leading zero.

To verify this open any file from your computer with an hex editor and modify the leading hex to 00.

You would most likely be unable to open the file, because you damage the signature but it still can be considered a valid file.

Outras dicas

The most common type of file is a binary file, which is composed of:

  • A stream of bytes, which can be completely arbitrary.
  • Metadata: name, length, owners, permissions, relevant dates, and so on.

This is the "view" of the file from the outside. From the inside, the file will also be associated with locations on disk. Furthermore, if the filesystem is journaled, recent changes to the file will also be stored.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a cs.stackexchange
scroll top