The Linux Programming Interface: a linux and unix system Programming Handbook



tải về 6.93 Mb.
Chế độ xem pdf
trang7/806
Chuyển đổi dữ liệu08.07.2022
Kích6.93 Mb.
#52607
1   2   3   4   5   6   7   8   9   10   ...   806
The Linux Programming Interface

3
SYSTEM PROGRAMMING CONCEPTS
 43
3.1
System Calls ............................................................................................................... 43
3.2
Library Functions ......................................................................................................... 46
3.3
The Standard C Library; The GNU C Library (
glibc
) ......................................................... 47
3.4
Handling Errors from System Calls and Library Functions.................................................. 48
3.5
Notes on the Example Programs in This Book.................................................................. 50
3.5.1
Command-Line Options and Arguments ..................................................... 50
3.5.2
Common Functions and Header Files......................................................... 51


xii
Contents in Detail
3.6
Portability Issues.......................................................................................................... 61
3.6.1
Feature Test Macros ................................................................................ 61
3.6.2
System Data Types.................................................................................. 63
3.6.3
Miscellaneous Portability Issues................................................................. 66
3.7
Summary.................................................................................................................... 68
3.8
Exercise ..................................................................................................................... 68
4
FILE I/O: THE UNIVERSAL I/O MODEL
 69
4.1
Overview ................................................................................................................... 69
4.2
Universality of I/O ...................................................................................................... 72
4.3
Opening a File: 
open()
................................................................................................. 72
4.3.1
The 
open()
flags
Argument........................................................................ 74
4.3.2
Errors from 
open()
................................................................................... 77
4.3.3
The 
creat()
System Call ............................................................................ 78
4.4
Reading from a File: 
read()
........................................................................................... 79
4.5
Writing to a File: 
write()
............................................................................................... 80
4.6
Closing a File: 
close()
................................................................................................... 80
4.7
Changing the File Offset: 
lseek()
.................................................................................... 81
4.8
Operations Outside the Universal I/O Model: 
ioctl()
....................................................... 86
4.9
Summary.................................................................................................................... 86
4.10
Exercises .................................................................................................................... 87

tải về 6.93 Mb.

Chia sẻ với bạn bè của bạn:
1   2   3   4   5   6   7   8   9   10   ...   806




Cơ sở dữ liệu được bảo vệ bởi bản quyền ©hocday.com 2024
được sử dụng cho việc quản lý

    Quê hương