Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/6911cc4b-5d54-800b-88ae-dc7ac6ff2d3d
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====== 三、 exec() 家族函数 ====== * '''功能:''' 运行其他程序来'''替换'''当前的进程 。新程序启动后会沿用原有进程的PID(进程标识符)。它通过明确指定要运行的程序来消除system()的歧义问题 。 * '''进程 (Process):''' 存储器中运行的程序,由一个数字(进程标识符,PID)来标识 。 * '''函数命名规则:''' exec 后可跟 l 或 v,以及可选的 p 和 e 。 * l ('''L'''ist): 接收参数列表 。 * v ('''V'''ector): 接收参数数组或向量 。 * p ('''P'''ATH): 根据 PATH 环境变量查找程序 。 * e ('''E'''nvironment): 接收环境变量字符串数组 。 * '''参数列表函数示例:''' execl(), execlp(), execle() 。参数列表必须以 NULL 结束 。 * '''参数数组函数示例:''' execv(), execvp(), execve() 。 * '''环境变量 (Environment Variables):''' * 每个进程都有一组环境变量 。 * C程序可以使用 stdlib.h 中的 getenv() 函数读取环境变量 。 * 使用以 e 结尾的 exec() 函数(如 execle())可以传递新的环境变量数组,数组格式为 "变量名=值",并以 NULL 结束 。
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)