On Stdio... - GNU/Linux

Users browsing this thread: 3 Guest(s)
movq
Long time nixers
Another thing to note:

(06-11-2016, 02:48 PM)pranomostro Wrote: every file is basically a stream of bytes.

I don't know of any *modern* operating system or file system where this statement is *not* true (as long as you consider ordinary files on disk -- I have no idea about "special files" on Windows or stuff like that). Historically, however, there were other approaches. For example, there were record-oriented file systems. The point is, the *operating system* would dictate a certain file format by enforcing a record-based structure. This isn't the case anymore today. Sure, your Linux application in user space can always do the same thing (organize a file in a certain way), but the kernel does not care at all. To the kernel, it's just a stream of bytes, and it's your job to bring order to chaos.

Quoting from "The UNIX Programming Environment" by Kernighan and Pike from 1984 (p. 44):

Quote:The Unix system is unusual in its approach to representing control information, particularly its use of newlines to terminate files. Many systems instead provide "records," one per line, each of which contains not only your data but also a count of the number of characters in the line (and no newline).
[...]
The Unix systems does neither -- there are no records, no record counts, and no bytes in any file that you or your programs did not put there.
[...]
For most purposes, this simple scheme is exactly what is wanted. When a more complicated structure is needed, it can easily be built on top of this; the converse, creating simplicity from complexity, is harder to achieve.


Messages In This Thread
On Stdio... - by NetherOrb - 05-11-2016, 09:02 PM
RE: On Stdio... - by movq - 06-11-2016, 10:14 AM
RE: On Stdio... - by pranomostro - 06-11-2016, 02:48 PM
RE: On Stdio... - by movq - 06-11-2016, 05:14 PM
RE: On Stdio... - by pranomostro - 06-11-2016, 07:24 PM
RE: On Stdio... - by NetherOrb - 06-11-2016, 11:28 PM
RE: On Stdio... - by apk - 07-11-2016, 12:13 AM
RE: On Stdio... - by NetherOrb - 07-11-2016, 12:21 AM
RE: On Stdio... - by venam - 07-11-2016, 01:49 AM
RE: On Stdio... - by jkl - 07-11-2016, 04:26 AM
RE: On Stdio... - by pranomostro - 07-11-2016, 07:26 AM
RE: On Stdio... - by z3bra - 07-11-2016, 08:57 AM
RE: On Stdio... - by jkl - 07-11-2016, 11:28 AM
RE: On Stdio... - by pranomostro - 07-11-2016, 12:43 PM
RE: On Stdio... - by jkl - 07-11-2016, 12:47 PM
RE: On Stdio... - by pranomostro - 07-11-2016, 01:28 PM
RE: On Stdio... - by jkl - 07-11-2016, 01:30 PM
RE: On Stdio... - by venam - 07-11-2016, 01:36 PM
RE: On Stdio... - by pranomostro - 07-11-2016, 02:43 PM
RE: On Stdio... - by jkl - 07-11-2016, 02:45 PM