Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
LINUX系統程式設計 第二版
by
Robert Love
December 2013
Intermediate to advanced
496 pages
8h 57m
Chinese
GoTop Information, Inc.
Content preview from
LINUX系統程式設計 第二版
28
|
第二章
out
,常簡寫為
stdout
),
而
fd 2
是
標準錯誤
(
standard error
,常簡寫為
stderr
)。實際
使用時,並不會直接使用這些整數值,而是使用
C
程式庫透過預處理器指令所定義的
STDIN_FILENO
、
STDOUT_FILENO
和
STDERR_FILENO
。按慣例,
stdin
會被連接到終端機的輸入
裝置(通常是用戶的鍵盤),
stdout
及
stderr
會被連接到終端機的顯示器。用戶可
重導
(
redirect
)這些標準檔案描述器,甚至是把一個程式的輸出「接管至」(
pipe into
)另一
個程式的輸入。這就是
shell
實作重導及導管的方法。
「檔案描述器」所能參用的不僅是正規檔案。它們還可用於存取裝置檔和導管、目錄和
futex
、
FIFO
以及
socket
—遵奉一切皆檔案的哲學,任何東西只要可以對它進行讀或寫
的操作,幾乎就能夠透過「檔案描述器」來對它進行讀或寫的操作。
預設情況下,子行程會取得其父行程之檔案表的副本。已開啟檔案的清單、它們的存取
模式、當前的檔案位置以及其他的中介資料都會一樣,但一個行程中的改變—例如,子
行程關閉了一個檔案—並不會影響其他行程的檔案表。雖然這是典型的做法,正如你在
第
5
章將看到的,子行程與父行程可以共享父行程的檔案表(正如執行緒所做那樣)。
開啟檔案
存取檔案的最基本方法就是透過
read()
及
write()
系統呼叫。然而,在存取一個檔案之
前,必須先透過
open()
或
creat()
系統呼叫開啟該檔案。一旦檔案使用完畢 ...
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.
Start your free trial
You might also like
優雅的SciPy|Python科學研究的美學
Juan Nunez-Iglesias, Stéfan van der Walt, Harriet Dashnow
成為卓越程式設計師的38項必修法則
Pete Goodliffe
深入理解運算原理|從簡單的機器到無所不能的程式
Tom Stuart
C++语言导学(原书第2版)
本贾尼 斯特劳斯特鲁普
Publisher Resources
ISBN: 9789862769812