- 论坛徽章:
- 0
|
程序的入口可否说是在一个fork()的时候,
fork()之后执行exec,
exec先初始化一些环境变量和参数,然后通过这些参数调用main,
fork创建新进程,exec执行新进程 —— <apue>
man stdin:
Since the symbols stdin, stdout, and stderr are specified to be macros, ... The standard streams are closed by a call to exit(3) and by normal program termination.
...
The stdin, stdout, and stderr macros conform to ANSI X3.159-1989 (``ANSI C89''), and this standard also stipulates that these three streams shall be open at program startup.
stdin/out/err确实是全局宏定义,不过在程序启动时(fork->exec)打开,结束时(exit)关闭,
不知道我说的对不对……
不过思一克的那个小程序该怎么解释? |
|