On Stdio... - GNU/Linux

Users browsing this thread: 3 Guest(s)
apk
Long time nixers
(06-11-2016, 02:48 PM)pranomostro Wrote: Okay, expanding what vain already said:

every file is basically a stream of bytes. You can read bytes from a stream, and you can write bytes
to a stream. When you read a file with the content 'abc', the first byte in the stream is 'a', the second
byte in the stream is 'b' and the third byte in the stream is 'c'.

This holds true for every file, for stdin and stdout and stderr, but also for regular disk files, like
music and image files, text files, source code, databases and so on, as well as pipes and redirections.

A redirection is a way of saving such a byte stream or retrieving it again, you create a byte stream
from a file a to the command cat by typing `cat <a`. The same is true when you redirect into a disk
file, then you can say `cat < a >b`. This does not depend on the file type, since file types do not
really exist on unix. You can treat a file in a certain way when it has a certain layout, but the
type is not intrinsically a direct attribute of the file. A C source code file is the same as an image.

Pipes are a mechanism that you don't need to save your byte stream on disk, but that you can use
it directly. `du -ab | sort -n` is an example for this, it produces a stream of bytes that is then
fed directly into a command, namely `sort`.

Okay, what is stdio? stdio is a part of the C standard library for dealing with such streams. It has support
for reading and writing streams with different functions such as fgets, printf and fwrite.

hey how do u get the orange text thats pretty cool


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