[Operating System] Files
File is a logical collection of 1's and 0's. There are two basic types of files:
- Text / ASCII files:
- Plain printable text. Generally human readable and editable.
- Examples: .c, .java, .txt.
- Binary files:
- Everything other than text files. It's kind of a misnomer, because text files are essentially binary as well.
- Generally not human readable and editable.
- Usually generated and interpreted by some program.
Endianness:
Endianness refers to how the binary data in a file is ordered. There are two types of Endianness conventions:
- Big Endian: bytes are stored in file from most significant bits (MSB) to least significant bits (LSB). Example: CADE 0000 0002
- Little Endian: bytes are stored in file from LSB to MSB. Example: DECA 0000 0200
In the UNIX operating system, I/O devices are modeled as files. You could open them, write bytes to them, and read bytes from them.
C library defines three constant (always open, cannot close) file handlers:
- stdin: standard input (console).
- stdout: standard output (console).
- stderr: standard error (console, for error message).
Comments
Post a Comment