Skip to Content
C语言核心技术(原书第2版)
book

C语言核心技术(原书第2版)

by Peter Prinz, Tony Crawford
August 2017
Intermediate to advanced
798 pages
17h 44m
Chinese
China Machine Press
Content preview from C语言核心技术(原书第2版)
函数简介
|
325
函数简介
表17-24:与操作系统交互的函数
目的 函数
查询一个环境变量的值
getenv()
、
getenv_s()
执行一个系统命令
system()
注册一个函数
,
它在程序退出时执行
atexit()
、
at_quick_exit()
正常地结束程序
exit()
、
_Exit()
、
quick_exit()
意外地结束程序
abort()
在
Unix
和
Windows
中,环境(
environment
)是进程的属性之一,它包含了一系列格式为
name
=
value
的
字符串。通常情况下,一个进程会继承由其父进程所生成的环境。函数
getenv()
是
程序接收控制信息的一种方式,例如,包括所需文件的目录名称。
与函数
exit()
行为相反,函数
_Exit()
会忽略所有信号,并且不会调用之前使用
atexit()
注册的任一函数。在
C99
中新增了函数
quick_exit()
,首先调用通过
at_
quick_exit()
注册的所有函数,然后通过调用
_Exit()
终止程序。函数
abort()
通过生成
信号
SIGABRT
,引发一个非常规的程序终止。
17.11.2 信号
操作系统会向进程发送各种信号,以通知这些进程不寻常的事件。这种事件一般包括严
重的错误,例如非法的内存访问或硬件中断,如定时器的通知。然而,信号也可能是由
控制台的用户发出,或者由程序本身调用函数
raise()
所造成的。
每个程序都可以自行决定如何处理特定信号。程序可以选择忽略信号,或者让默认的信
号处理器来处理信号,或者安装自己的信号处理器函数。信号处理器是一种函数,当程 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

算法精讲视频课程:24篇系列讲座

算法精讲视频课程:24篇系列讲座

罗伯特·塞奇威克, 凯文·韦恩(Kevin Wayne)

Publisher Resources

ISBN: 9787111562207