-
c - Do stdio file descriptors (stdin, stdout, stderr) get opened, simply from #include'ing <stdio.h>? - Stack Overflow
- standard streams of a program are opened by the operating system? or, inherit from its parent (, which inherit from its ancestor who opens these standard streams).
- initialization - execute
- initialization: loading symbol tables, assigning memory, initializing static data, linking dynamic libraries, open standard streams.
- execute: main() function
- fork() - exec():
- fork(): to create a new process, which is still running under shell code.
- exec(): to yield control from shell code to user code.
- (standard) file descriptors 0, 1, and 2 (or more customer ones)
-
file - What does 'stream' mean in C? - Stack Overflow
- file & stream.
- 文件-静态,流-(input/流入、output/流出间可)异步动态。
- pipe / tube / flow. pool/池。
-
具象的files, sockets, device (keyboards, USB ports, printers),抽象为接口/interface,logical entity,称为数据流/data stream 。
- 此抽象亦叫做文件句柄——pointer to the stream.
- cout 是C++中的output stream的对象(封装)形式。
- Standard streams - Wikipedia
In computer programming, standard streams are interconnected input and output communication channels[1] between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin), standard output (stdout) and standard error (stderr). Originally I/O happened via a physically connected system console (input via keyboard, output via monitor), but standard streams abstract this. When a command is executed via an interactive shell, the streams are typically connected to the text terminal on which the shell is running, but can be changed with redirection or a pipeline. More generally, a child process inherits the standard streams of its parent process.
- 考虑:
- (基于内存的)虚拟文件对象/流;->效果无益
-
公共文件对象/流;->见下
- Lua中的io.tmpfile() 。
- 搜索: