由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - 大侠帮忙看看这段程序,想不通
相关主题
奇怪的 printf!! ksh programminghow to implement background process using execl()
[转载] UNIX下的strtok.cshrc?.login?.profile?
[转载] 活见鬼了---搞不定的程序奇怪问题一个
fork() and execve() in Unixstrange problem about wget execution
[转载] Help, about clock().关于一个C++library的连接
sed question??emacs问题求教----有关C程序格式
Re: 为什么emacs自动给我加^M.interview question
急,帮个忙awk question
相关话题的讨论汇总
话题: image话题: execl话题: process话题: echo话题: file
进入Unix版参与讨论
1 (共1页)
a*****n
发帖数: 439
1
#include
main()
{
printf("Maybe.\n");
execl("/bin/echo","echo","Always.\n",NULL);
printf("display?");
}
为什么display?不会被显示?
D****g
发帖数: 2860
2
man execl:
...
Each of the functions in the exec family replaces the
current process image with a new process image. The new
image is constructed from a regular, executable file called
the new process image file. This file is either an execut-
able object file or a file of data for an interpreter. There
is no return from a successful call to one of these func-
tions because the calling process image is overlaid by the
new process image.

【在 a*****n 的大作中提到】
: #include
: main()
: {
: printf("Maybe.\n");
: execl("/bin/echo","echo","Always.\n",NULL);
: printf("display?");
: }
: 为什么display?不会被显示?

a*****n
发帖数: 439
3
是不是说这个main
process在执行了execl以后,线程就被替换为echo,然后结束,无论execl后面有任何代码都
不会被执行?
谢了?

【在 D****g 的大作中提到】
: man execl:
: ...
: Each of the functions in the exec family replaces the
: current process image with a new process image. The new
: image is constructed from a regular, executable file called
: the new process image file. This file is either an execut-
: able object file or a file of data for an interpreter. There
: is no return from a successful call to one of these func-
: tions because the calling process image is overlaid by the
: new process image.

D****g
发帖数: 2860
4
correct.

【在 a*****n 的大作中提到】
: 是不是说这个main
: process在执行了execl以后,线程就被替换为echo,然后结束,无论execl后面有任何代码都
: 不会被执行?
: 谢了?

1 (共1页)
进入Unix版参与讨论
相关主题
awk question[转载] Help, about clock().
问一个Unix Shell Script 的问题sed question??
A problem about child process.Re: 为什么emacs自动给我加^M.
UNIX文件系统一问急,帮个忙
奇怪的 printf!! ksh programminghow to implement background process using execl()
[转载] UNIX下的strtok.cshrc?.login?.profile?
[转载] 活见鬼了---搞不定的程序奇怪问题一个
fork() and execve() in Unixstrange problem about wget execution
相关话题的讨论汇总
话题: image话题: execl话题: process话题: echo话题: file