xlsx文件按列筛选拆分工具V7
功能
1、一个xlsx文件,可以选择按列拆分成多个文件
2、一个xlsx文件,可以选择按列拆分成一个文件多个sheet,每个分组一个sheet
使用说明:
1、输入文件名改为"input.xlsx",第一行必须为列名称,不要留空行
2、将“mysplit_v7.exe”和“input.xlsx”放到同一个目录中
3、双击“mysplit_v7.exe”运行,可以按需选择列,来拆分多个文件,
4、运行结果保存在当目录新建一个文件夹yyyymmddHHMMSS
注意:
1、若选择列有空值会保存到“空值.xlsx”或者名字为“空值”的sheet
2、输出文件首行加粗,第一列为序号,顺序从1开始
3、如果有很长的数据,拆分后自动转成科学计数格式,解决办法:在该列最后一行随便输入一些字符:aa,筛选列下面流空
xlsx文件按列筛选拆分成多个文件工具
xlsx文件按列筛选拆分成多个文件工具
可以按需选择列,来拆分多个文件
有python源代码,exe可执行文件,测试按列,使用说明
apache hadoop 2.7.2.chm
apahe hadoop2.7.2 官方文档,离线版
General
Overview
Single Node Setup
Cluster Setup
Hadoop Commands Reference
FileSystem Shell
Hadoop Compatibility
Interface Classification
FileSystem Specification
Common
CLI Mini Cluster
Native Libraries
Proxy User
Rack Awareness
Secure Mode
Service Level Authorization
HTTP Authentication
Hadoop KMS
Tracing
HDFS
HDFS User Guide
HDFS Commands Reference
High Availability With QJM
High Availability With NFS
Federation
ViewFs Guide
HDFS Snapshots
HDFS Architecture
Edits Viewer
Image Viewer
Permissions and HDFS
Quotas and HDFS
HFTP
C API libhdfs
WebHDFS REST API
HttpFS Gateway
Short Circuit Local Reads
Centralized Cache Management
HDFS NFS Gateway
HDFS Rolling Upgrade
Extended Attributes
Transparent Encryption
HDFS Support for Multihoming
Archival Storage, SSD & Memory
Memory Storage Support
MapReduce
MapReduce Tutorial
MapReduce Commands Reference
Compatibilty between Hadoop 1.x and Hadoop 2.x
Encrypted Shuffle
Pluggable Shuffle/Sort
Distributed Cache Deploy
MapReduce REST APIs
MR Application Master
MR History Server
YARN
Overview
YARN Architecture
Capacity Scheduler
Fair Scheduler
ResourceManager Restart
ResourceManager HA
Node Labels
Web Application Proxy
YARN Timeline Server
Writing YARN Applications
YARN Commands
NodeManager Restart
DockerContainerExecutor
Using CGroups
Secure Containers
Registry
YARN REST APIs
Introduction
Resource Manager
Node Manager
Timeline Server
Hadoop Compatible File Systems
Amazon S3
Azure Blob Storage
OpenStack Swift
Auth
Overview
Examples
Configuration
Building
Tools
Hadoop Streaming
Hadoop Archives
DistCp
GridMix
Rumen
Scheduler Load Simulator
Reference
Release Notes
API docs
Common CHANGES.txt
HDFS CHANGES.txt
MapReduce CHANGES.txt
YARN CHANGES.txt
Metrics
Configuration
core-default.xml
hdfs-default.xml
mapred-default.xml
yarn-default.xml
Deprecated Properties
AIX命令参考大全
《AIX 5L V5.2 命令参考大全》 共6卷。
LinuxMan.chm
转:This CHM is make from ManPages V3.32 by hhpt@163.com.
C++Primer第四版中文版+英文版+习题答案+源代码
经典不必多说!
C++Primer第四版中文版+英文版+习题答案+源代码+CHM格式(中英版)
C++ 标准库(第一版+第二版+源代码+PDF
2014/05/18 17:14 3,537,801 C++.Standard Library,The.A.Tutorial.and.Reference.chm
2014/05/18 17:31 13,108,234 C++标准程序库.pdf
2014/05/18 18:09 236,213 cppstdlib-code.zip
2014/05/18 18:10 169,927 examples.zip
2014/05/18 18:02 14,470,662 The C++ Standard Library A Tutorial and Reference (2nd Edition).pdf
2014/05/18 17:54 4,801,530 The C++ Standard Library.pdf
7 个文件 36,324,367 字节
C++标准库(第二版)英文版.pdf
The C++ Standard Library A Tutorial and Reference (2nd Edition)+cppstdlib-code.zip
C++标准库(第二版)英文版.pdf 非扫描版+源代码
Prefaceto the SecondEdition xxiii
Acknowledgments for the SecondEdition xxiv
Prefaceto the FirstEdition xxv
Acknowledgments for the FirstEdition xxvi
1 About This Book 1
1.1 Why This Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Before ReadingThis Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Styleand Structure of the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 How to ReadThis Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Stateof the Art . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.6 Example Codeand AdditionalInformation . . . . . . . . . . . . . . . . . . . . . 5
1.7 Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Introduction to C++ and the StandardLibrary 7
2.1 Historyof the C++ Standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.1 Common Questionsabout the C++11 Standard . . . . . . . . . . . . . . 8
2.1.2 Compatibility between C++98 and C++11 . . . . . . . . . . . . . . . . . 9
2.2 Complexity and Big-O Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3 New LanguageFeatures 13
3.1 New C++11 Language Features . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.1.1 Important MinorSyntax Cleanups . . . . . . . . . . . . . . . . . . . . . 13
3.1.2 AutomaticType Deductionwith auto . . . . . . . . . . . . . . . . . . . 14
3.1.3 UniformInitialization and Initializer Lists . . . . . . . . . . . . . . . . . 15
3.1.4 Range-Basedfor Loops . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.1.5 MoveSemanticsand Rvalue References . . . . . . . . . . . . . . . . . . 19
viii Contents
3.1.6 New String Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.1.7 Keyword noexcept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.1.8 Keyword constexpr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.1.9 New Template Features . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.1.10 Lambdas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.1.11 Keyword decltype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.1.12 New Function Declaration Syntax . . . . . . . . . . . . . . . . . . . . . 32
3.1.13 Scoped Enumerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.1.14 New FundamentalData Types . . . . . . . . . . . . . . . . . . . . . . . 33
3.2 Old “New” Language Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.2.1 ExplicitInitialization for FundamentalTypes . . . . . . . . . . . . . . . 37
3.2.2 Definitionof main() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4 GeneralConcepts 39
4.1 Namespace std . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.2 Header Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.3 Errorand ExceptionHandling . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.3.1 Standard ExceptionClasses. . . . . . . . . . . . . . . . . . . . . . . . . 41
4.3.2 Members of ExceptionClasses. . . . . . . . . . . . . . . . . . . . . . . 44
4.3.3 PassingExceptions with Classexception_ptr . . . . . . . . . . . . . . 52
4.3.4 Throwing Standard Exceptions . . . . . . . . . . . . . . . . . . . . . . . 53
4.3.5 Deriving from Standard ExceptionClasses. . . . . . . . . . . . . . . . . 54
4.4 CallableObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.5 Concurrencyand Multithreading. . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.6 Allocators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5 Utilities 59
5.1 Pairs and Tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.1.1 Pairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.1.2 Tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
5.1.3 I/O for Tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.1.4 Conversions between tuple sandpairs . . . . . . . . . . . . . . . . . . 75
5.2 Smart Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.2.1 Classshared_ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.2.2 Classweak_ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
5.2.3 Misusing Shared Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.2.4 Shared and WeakPointersin Detail. . . . . . . . . . . . . . . . . . . . . 92
5.2.5 Classunique_ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Contents ix
5.2.6 Classunique_ptrin Detail . . . . . . . . . . . . . . . . . . . . . . . . 110
5.2.7 Classauto_ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
5.2.8 FinalWordsonSmart Pointers . . . . . . . . . . . . . . . . . . . . . . . 114
5.3 Numeric Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
5.4 Type Traitsand Type Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
5.4.1 Purposeof Type Traits . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
5.4.2 Type Traitsin Detail. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
5.4.3 ReferenceWrappers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
5.4.4 Function Type Wrappers . . . . . . . . . . . . . . . . . . . . . . . . . . 133
5.5 Auxiliary Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
5.5.1 Processing the Minimumand Maximum. . . . . . . . . . . . . . . . . . 134
5.5.2 Swapping Two Va l u e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
5.5.3 SupplementaryComparison Operators . . . . . . . . . . . . . . . . . . . 138
5.6 Compile-Time FractionalArithmeticwith Classratio . . . . . . . . . . . . . 140
5.7 Clocks and Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
5.7.1 Overview of the ChronoLibrary . . . . . . . . . . . . . . . . . . . . . . 143
5.7.2 Durations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
5.7.3 Clocks and Timepoints . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
5.7.4 Date and TimeFunctions byC and POSIX . . . . . . . . . . . . . . . . . 157
5.7.5 Blocking with Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
5.8 Header Files , ,and . . . . . . . . . . . . . . 161
5.8.1 Definitionsin . . . . . . . . . . . . . . . . . . . . . . . . . . 161
5.8.2 Definitionsin . . . . . . . . . . . . . . . . . . . . . . . . . . 162
5.8.3 Definitionsin . . . . . . . . . . . . . . . . . . . . . . . . . . 163
6 The StandardTe m p l a t e Library 165
6.1 STL Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
6.2 Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
6.2.1 Sequence Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
6.2.2 Associative Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
6.2.3 UnorderedContainers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
6.2.4 Associative Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
6.2.5 OtherContainers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
6.2.6 Container Adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
6.3 Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
6.3.1 Further Examples of UsingAssociative and UnorderedContainers . . . . 193
6.3.2 Iterator Categories. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
x Contents
6.4 Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
6.4.1 Ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
6.4.2 Handling MultipleRanges . . . . . . . . . . . . . . . . . . . . . . . . . 207
6.5 Iterator Adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
6.5.1 Insert Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
6.5.2 Stream Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
6.5.3 ReverseIterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
6.5.4 MoveIterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
6.6 User-DefinedGenericFunctions . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
6.7 ManipulatingAlgorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
6.7.1 “Removing”Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
6.7.2 ManipulatingAssociative and UnorderedContainers . . . . . . . . . . . 221
6.7.3 Algorithms versus MemberFunctions . . . . . . . . . . . . . . . . . . . 223
6.8 Functions as AlgorithmArguments . . . . . . . . . . . . . . . . . . . . . . . . . 224
6.8.1 UsingFunctions as AlgorithmArguments . . . . . . . . . . . . . . . . . 224
6.8.2 Predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
6.9 UsingLambdas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
6.10 Function Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
6.10.1 Definitionof Function Objects . . . . . . . . . . . . . . . . . . . . . . . 233
6.10.2 PredefinedFunction Objects . . . . . . . . . . . . . . . . . . . . . . . . 239
6.10.3 Binders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
6.10.4 Function Objectsand Bindersversus Lambdas . . . . . . . . . . . . . . . 243
6.11 Container Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
6.11.1 Requirements for Container Elements . . . . . . . . . . . . . . . . . . . 244
6.11.2 Va l u eSemanticsor ReferenceSemantics. . . . . . . . . . . . . . . . . . 245
6.12 Errors and Exceptions inside the STL . . . . . . . . . . . . . . . . . . . . . . . . 245
6.12.1 ErrorHandling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
6.12.2 ExceptionHandling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
6.13 Extendingthe STL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
6.13.1 Integrating AdditionalTypes . . . . . . . . . . . . . . . . . . . . . . . . 250
6.13.2 Deriving from STL Types . . . . . . . . . . . . . . . . . . . . . . . . . . 251
7 STL Containers 253
7.1 Common Container Abilitiesand Operations . . . . . . . . . . . . . . . . . . . . 254
7.1.1 Container Abilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
7.1.2 Container Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
7.1.3 Container Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Contents xi
7.2 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
7.2.1 Abilitiesof Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
7.2.2 ArrayOperations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
7.2.3 Usingarray s as C-StyleArrays . . . . . . . . . . . . . . . . . . . . . . 267
7.2.4 ExceptionHandling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
7.2.5 TupleInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
7.2.6 Examples of UsingArrays . . . . . . . . . . . . . . . . . . . . . . . . . 268
7.3 Ve c t o r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
7.3.1 Abilitiesof Ve c t o r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
7.3.2 Ve c t o r Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
7.3.3 UsingVe c t o r sas C-StyleArrays . . . . . . . . . . . . . . . . . . . . . . 278
7.3.4 ExceptionHandling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
7.3.5 Examples of UsingVe c t o r s . . . . . . . . . . . . . . . . . . . . . . . . . 279
7.3.6 Classvector . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
7.4 Deques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
7.4.1 Abilitiesof Deques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
7.4.2 Deque Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
7.4.3 ExceptionHandling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
7.4.4 Examples of UsingDeques. . . . . . . . . . . . . . . . . . . . . . . . . 288
7.5 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
7.5.1 Abilitiesof Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
7.5.2 List Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
7.5.3 ExceptionHandling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
7.5.4 Examples of UsingLists . . . . . . . . . . . . . . . . . . . . . . . . . . 298
7.6 Forward Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
7.6.1 Abilitiesof Forward Lists . . . . . . . . . . . . . . . . . . . . . . . . . . 300
7.6.2 Forward List Operations . . . . . . . . . . . . . . . . . . . . . . . . . . 302
7.6.3 ExceptionHandling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
7.6.4 Examples of UsingForward Lists . . . . . . . . . . . . . . . . . . . . . . 312
7.7 Sets and Multisets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
7.7.1 Abilitiesof Sets and Multisets . . . . . . . . . . . . . . . . . . . . . . . 315
7.7.2 Setand MultisetOperations. . . . . . . . . . . . . . . . . . . . . . . . . 316
7.7.3 ExceptionHandling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
7.7.4 Examples of UsingSets and Multisets . . . . . . . . . . . . . . . . . . . 325
7.7.5 Example of Specifying the Sorting Criterion at Runtime . . . . . . . . . . 328
xii Contents
7.8 Mapsand Multimaps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
7.8.1 Abilitiesof Mapsand Multimaps. . . . . . . . . . . . . . . . . . . . . . 332
7.8.2 Map and Multimap Operations . . . . . . . . . . . . . . . . . . . . . . . 333
7.8.3 UsingMapsas Associative Arrays . . . . . . . . . . . . . . . . . . . . . 343
7.8.4 ExceptionHandling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
7.8.5 Examples of UsingMapsand Multimaps. . . . . . . . . . . . . . . . . . 345
7.8.6 Example with Maps,Strings,and Sorting Criterion at Runtime . . . . . . 351
7.9 UnorderedContainers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
7.9.1 Abilitiesof UnorderedContainers . . . . . . . . . . . . . . . . . . . . . 357
7.9.2 Creating and Controlling UnorderedContainers . . . . . . . . . . . . . . 359
7.9.3 OtherOperationsfor UnorderedContainers . . . . . . . . . . . . . . . . 367
7.9.4 The Bucket Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
7.9.5 UsingUnorderedMapsas Associative Arrays . . . . . . . . . . . . . . . 374
7.9.6 ExceptionHandling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
7.9.7 Examples of UsingUnorderedContainers . . . . . . . . . . . . . . . . . 375
7.10 OtherSTL Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
7.10.1 Strings as STL Containers . . . . . . . . . . . . . . . . . . . . . . . . . 385
7.10.2 Ordinary C-StyleArrays as STL Containers . . . . . . . . . . . . . . . . 386
7.11 Implementing ReferenceSemantics . . . . . . . . . . . . . . . . . . . . . . . . . 388
7.12 Whento Use WhichContainer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
8 STL ContainerMembersin Detail 397
8.1 Type Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
8.2 Create, Copy,and DestroyOperations . . . . . . . . . . . . . . . . . . . . . . . . 400
8.3 Nonmodifying Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
8.3.1 Size Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
8.3.2 Comparison Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
8.3.3 Nonmodifying Operationsfor Associative and UnorderedContainers . . . 404
8.4 Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
8.5 Direct ElementAccess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
8.6 Operationsto Generate Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
8.7 Inserting and RemovingElements . . . . . . . . . . . . . . . . . . . . . . . . . . 411
8.7.1 Inserting Single Elements . . . . . . . . . . . . . . . . . . . . . . . . . . 411
8.7.2 Inserting MultipleElements . . . . . . . . . . . . . . . . . . . . . . . . . 416
8.7.3 RemovingElements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
8.7.4 Resizing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
Contents xiii
8.8 Special MemberFunctions for Lists and Forward Lists . . . . . . . . . . . . . . . 420
8.8.1 Special MemberFunctions for Lists (and Forward Lists) . . . . . . . . . 420
8.8.2 Special MemberFunctions for Forward Lists Only . . . . . . . . . . . . 423
8.9 Container Policy Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
8.9.1 Nonmodifying Policy Functions . . . . . . . . . . . . . . . . . . . . . . 427
8.9.2 ModifyingPolicy Functions . . . . . . . . . . . . . . . . . . . . . . . . 428
8.9.3 Bucket Interface for UnorderedContainers . . . . . . . . . . . . . . . . . 429
8.10 Allocator Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
8.10.1 FundamentalAllocator Members . . . . . . . . . . . . . . . . . . . . . . 430
8.10.2 Constructorswith Optional Allocator Parameters . . . . . . . . . . . . . 430
9 STL Iterators 433
9.1 Header Files for Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
9.2 Iterator Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
9.2.1 Output Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
9.2.2 Input Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
9.2.3 Forward Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
9.2.4 BidirectionalIterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
9.2.5 Random-Access Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . 438
9.2.6 The Incrementand DecrementProblem of Ve c t o r Iterators . . . . . . . . 440
9.3 Auxiliary Iterator Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
9.3.1 advance() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
9.3.2 next()and prev(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
9.3.3 distance() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
9.3.4 iter_swap() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
9.4 Iterator Adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
9.4.1 ReverseIterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
9.4.2 Insert Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
9.4.3 Stream Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
9.4.4 MoveIterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466
9.5 Iterator Traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466
9.5.1 WritingGenericFunctions for Iterators . . . . . . . . . . . . . . . . . . . 468
9.6 WritingUser-DefinedIterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
xiv Contents
10 STL Function Objectsand UsingLambdas 475
10.1 The Conceptof Function Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 475
10.1.1 Function Objectsas Sorting Criteria . . . . . . . . . . . . . . . . . . . . 476
10.1.2 Function Objectswith Internal State . . . . . . . . . . . . . . . . . . . . 478
10.1.3 The Return Va l u eof for_each() . . . . . . . . . . . . . . . . . . . . . 482
10.1.4 Predicatesversus Function Objects. . . . . . . . . . . . . . . . . . . . . 483
10.2 PredefinedFunction Objectsand Binders . . . . . . . . . . . . . . . . . . . . . . 486
10.2.1 PredefinedFunction Objects . . . . . . . . . . . . . . . . . . . . . . . . 486
10.2.2 Function Adapters and Binders. . . . . . . . . . . . . . . . . . . . . . . 487
10.2.3 User-DefinedFunction Objectsfor Function Adapters . . . . . . . . . . . 495
10.2.4 Deprecated Function Adapters . . . . . . . . . . . . . . . . . . . . . . . 497
10.3 UsingLambdas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
10.3.1 Lambdas versus Binders . . . . . . . . . . . . . . . . . . . . . . . . . . 499
10.3.2 Lambdas versus StatefulFunction Objects. . . . . . . . . . . . . . . . . 500
10.3.3 Lambdas Calling Global and MemberFunctions . . . . . . . . . . . . . . 502
10.3.4 Lambdas as HashFunction, Sorting,or Equivalence Criterion . . . . . . . 504
11 STL Algorithms 505
11.1 AlgorithmHeader Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
11.2 AlgorithmOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
11.2.1 A BriefIntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506
11.2.2 Classification of Algorithms . . . . . . . . . . . . . . . . . . . . . . . . 506
11.3 Auxiliary Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
11.4 The for_each()Algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
11.5 Nonmodifying Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
11.5.1 Counting Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
11.5.2 Minimumand Maximum. . . . . . . . . . . . . . . . . . . . . . . . . . 525
11.5.3 SearchingElements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
11.5.4 Comparing Ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
11.5.5 Predicatesfor Ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550
11.6 ModifyingAlgorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
11.6.1 Copying Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
11.6.2 MovingElements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
11.6.3 Transforming and Combining Elements . . . . . . . . . . . . . . . . . . 563
11.6.4 Swapping Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
11.6.5 AssigningNew Va l u e s . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
11.6.6 ReplacingElements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
Contents xv
11.7 RemovingAlgorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575
11.7.1 RemovingCertain Va l u e s . . . . . . . . . . . . . . . . . . . . . . . . . . 575
11.7.2 RemovingDuplicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
11.8 Mutating Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
11.8.1 Reversingthe Orderof Elements . . . . . . . . . . . . . . . . . . . . . . 583
11.8.2 Rotating Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584
11.8.3 PermutingElements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587
11.8.4 Shuffling Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
11.8.5 MovingElements to the Front . . . . . . . . . . . . . . . . . . . . . . . 592
11.8.6 Partition into Two Subranges . . . . . . . . . . . . . . . . . . . . . . . . 594
11.9 Sorting Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
11.9.1 Sorting AllElements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
11.9.2 Partial Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
11.9.3 Sorting Accordingto the n th Element . . . . . . . . . . . . . . . . . . . 602
11.9.4 HeapAlgorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
11.10 Sorted-Range Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
11.10.1SearchingElements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
11.10.2MergingElements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
11.11 Numeric Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623
11.11.1Processing Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623
11.11.2Converting Relativeand Absolute Va l u e s . . . . . . . . . . . . . . . . . . 627
12 SpecialContainers 631
12.1 Stacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632
12.1.1 The Core Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
12.1.2 Example of UsingStacks . . . . . . . . . . . . . . . . . . . . . . . . . . 633
12.1.3 A User-DefinedStackClass. . . . . . . . . . . . . . . . . . . . . . . . . 635
12.1.4 Classstack in Detail . . . . . . . . . . . . . . . . . . . . . . . . . . 637
12.2 Queues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
12.2.1 The Core Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
12.2.2 Example of UsingQueues . . . . . . . . . . . . . . . . . . . . . . . . . 640
12.2.3 A User-DefinedQueue Class . . . . . . . . . . . . . . . . . . . . . . . . 641
12.2.4 Classqueue in Detail . . . . . . . . . . . . . . . . . . . . . . . . . . 641
12.3 PriorityQueues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
12.3.1 The Core Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643
12.3.2 Example of UsingPriorityQueues. . . . . . . . . . . . . . . . . . . . . 643
12.3.3 Classpriority_queue in Detail . . . . . . . . . . . . . . . . . . . . 644
xvi Contents
12.4 Container Adapters in Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
12.4.1 Type Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
12.4.2 Constructors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646
12.4.3 SupplementaryConstructorsfor PriorityQueues. . . . . . . . . . . . . . 646
12.4.4 Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
12.5 Bitsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 650
12.5.1 Examples of UsingBitsets . . . . . . . . . . . . . . . . . . . . . . . . . 651
12.5.2 Classbitsetin Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
13 Strings 655
13.1 Purposeof the String Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656
13.1.1 A First Example: Extractinga Temporary Filename . . . . . . . . . . . . 656
13.1.2 A Second Example: ExtractingWordsand PrintingThemBackward . . . 660
13.2 Description of the String Classes . . . . . . . . . . . . . . . . . . . . . . . . . . 663
13.2.1 String Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663
13.2.2 OperationOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666
13.2.3 Constructorsand Destructor . . . . . . . . . . . . . . . . . . . . . . . . 667
13.2.4 Strings and C-Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668
13.2.5 Size and Capacity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669
13.2.6 ElementAccess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671
13.2.7 Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672
13.2.8 Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673
13.2.9 Substringsand String Concatenation . . . . . . . . . . . . . . . . . . . . 676
13.2.10Input/Output Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
13.2.11Searchingand Finding . . . . . . . . . . . . . . . . . . . . . . . . . . . 678
13.2.12The Va l u enpos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
13.2.13Numeric Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
13.2.14Iterator Supportfor Strings . . . . . . . . . . . . . . . . . . . . . . . . . 684
13.2.15Internationalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689
13.2.16Performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692
13.2.17Strings and Ve c t o r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692
13.3 String Classin Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693
13.3.1 Type Definitionsand StaticVa l u e s . . . . . . . . . . . . . . . . . . . . . 693
13.3.2 Create, Copy,and DestroyOperations . . . . . . . . . . . . . . . . . . . 694
13.3.3 Operationsfor Size and Capacity . . . . . . . . . . . . . . . . . . . . . . 696
13.3.4 Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
13.3.5 Character Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
13.3.6 GeneratingC-Strings and Character Arrays . . . . . . . . . . . . . . . . 700
Contents xvii
13.3.7 ModifyingOperations. . . . . . . . . . . . . . . . . . . . . . . . . . . . 700
13.3.8 Searchingand Finding . . . . . . . . . . . . . . . . . . . . . . . . . . . 708
13.3.9 Substringsand String Concatenation . . . . . . . . . . . . . . . . . . . . 711
13.3.10Input/Output Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 712
13.3.11Numeric Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713
13.3.12GeneratingIterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714
13.3.13Allocator Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715
14 RegularExpressions 717
14.1 The Regex Matchand Search Interface . . . . . . . . . . . . . . . . . . . . . . . 717
14.2 Dealingwith Subexpressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720
14.3 Regex Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726
14.4 Regex Token Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727
14.5 ReplacingRegularExpressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 730
14.6 Regex Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732
14.7 Regex Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735
14.8 The Regex ECMAScriptGrammar . . . . . . . . . . . . . . . . . . . . . . . . . 738
14.9 OtherGrammars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739
14.10 BasicRegex Signaturesin Detail . . . . . . . . . . . . . . . . . . . . . . . . . . 740
15 Input/Output UsingStreamClasses 743
15.1 Common Background of I/O Streams . . . . . . . . . . . . . . . . . . . . . . . . 744
15.1.1 Stream Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744
15.1.2 Stream Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744
15.1.3 Global Stream Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 745
15.1.4 Stream Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745
15.1.5 Manipulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746
15.1.6 A Simple Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746
15.2 FundamentalStream Classesand Objects. . . . . . . . . . . . . . . . . . . . . . 748
15.2.1 Classes and ClassHierarchy . . . . . . . . . . . . . . . . . . . . . . . . 748
15.2.2 Global Stream Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 751
15.2.3 Header Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752
15.3 Standard Stream Operators <> . . . . . . . . . . . . . . . . . . . . . . . . 753
15.3.1 Output Operator <> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
15.3.3 Input/Output of Special Types . . . . . . . . . . . . . . . . . . . . . . . 755
xviii Contents
15.4 Stateof Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758
15.4.1 Constants for the Stateof Streams . . . . . . . . . . . . . . . . . . . . . 758
15.4.2 MemberFunctions Accessingthe Stateof Streams. . . . . . . . . . . . . 759
15.4.3 Stream Stateand BooleanConditions . . . . . . . . . . . . . . . . . . . 760
15.4.4 Stream Stateand Exceptions . . . . . . . . . . . . . . . . . . . . . . . . 762
15.5 Standard Input/Output Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 767
15.5.1 MemberFunctions for Input . . . . . . . . . . . . . . . . . . . . . . . . 768
15.5.2 MemberFunctions for Output . . . . . . . . . . . . . . . . . . . . . . . 771
15.5.3 Example Uses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 772
15.5.4 sentryObjects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 772
15.6 Manipulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 774
15.6.1 Overview of AllManipulators . . . . . . . . . . . . . . . . . . . . . . . 774
15.6.2 How ManipulatorsWork . . . . . . . . . . . . . . . . . . . . . . . . . . 776
15.6.3 User-DefinedManipulators. . . . . . . . . . . . . . . . . . . . . . . . . 777
15.7 Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779
15.7.1 Format Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779
15.7.2 Input/Output Format of BooleanVa l u e s . . . . . . . . . . . . . . . . . . 781
15.7.3 FieldWidth, Fill Character,and Adjustment . . . . . . . . . . . . . . . . 781
15.7.4 PositiveSign and UppercaseLetters . . . . . . . . . . . . . . . . . . . . 784
15.7.5 Numeric Base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785
15.7.6 Floating-Point Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . 787
15.7.7 GeneralFormatting Definitions . . . . . . . . . . . . . . . . . . . . . . . 789
15.8 Internationalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790
15.9 File Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
15.9.1 File Stream Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
15.9.2 Rvalue and MoveSemanticsfor File Streams . . . . . . . . . . . . . . . 795
15.9.3 File Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796
15.9.4 RandomAccess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799
15.9.5 UsingFile Descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . 801
15.10 Stream Classesfor Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802
15.10.1String Stream Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802
15.10.2MoveSemanticsfor String Streams. . . . . . . . . . . . . . . . . . . . . 806
15.10.3char* Stream Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 807
15.11 Input/Output Operators for User-DefinedTypes . . . . . . . . . . . . . . . . . . . 810
15.11.1Implementing Output Operators . . . . . . . . . . . . . . . . . . . . . . 810
15.11.2Implementing Input Operators . . . . . . . . . . . . . . . . . . . . . . . 812
15.11.3Input/Output UsingAuxiliary Functions . . . . . . . . . . . . . . . . . . 814
Contents xix
15.11.4User-DefinedFormat Flags . . . . . . . . . . . . . . . . . . . . . . . . . 815
15.11.5Conventionsfor User-DefinedInput/Output Operators . . . . . . . . . . . 818
15.12 Connecting Input and Output Streams . . . . . . . . . . . . . . . . . . . . . . . . 819
15.12.1Loose Coupling Usingtie() . . . . . . . . . . . . . . . . . . . . . . . . 819
15.12.2TightCoupling UsingStream Buffers . . . . . . . . . . . . . . . . . . . 820
15.12.3Redirecting Standard Streams. . . . . . . . . . . . . . . . . . . . . . . . 822
15.12.4Streamsfor Readingand Writing. . . . . . . . . . . . . . . . . . . . . . 824
15.13 The Stream Buffer Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826
15.13.1The Stream Buffer Interfaces . . . . . . . . . . . . . . . . . . . . . . . . 826
15.13.2Stream Buffer Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . 828
15.13.3User-DefinedStream Buffers . . . . . . . . . . . . . . . . . . . . . . . . 832
15.14 PerformanceIssues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 844
15.14.1Synchronization with C’sStandard Streams . . . . . . . . . . . . . . . . 845
15.14.2Buffering in Stream Buffers . . . . . . . . . . . . . . . . . . . . . . . . . 845
15.14.3UsingStream Buffers Directly . . . . . . . . . . . . . . . . . . . . . . . 846
16 Internationalization 849
16.1 Character Encodingsand Character Sets . . . . . . . . . . . . . . . . . . . . . . . 850
16.1.1 Multibyte and Wide-CharacterText . . . . . . . . . . . . . . . . . . . . . 850
16.1.2 Different Character Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 851
16.1.3 Dealingwith Character Sets in C++ . . . . . . . . . . . . . . . . . . . . 852
16.1.4 Character Traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 853
16.1.5 Internationalization of Special Characters . . . . . . . . . . . . . . . . . 857
16.2 The Conceptof Locales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857
16.2.1 UsingLocales. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 858
16.2.2 Locale Facets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 864
16.3 Localesin Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 866
16.4 Facets in Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 869
16.4.1 Numeric Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 870
16.4.2 Monetary Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 874
16.4.3 Timeand Date Formatting . . . . . . . . . . . . . . . . . . . . . . . . . 884
16.4.4 Character Classification and Conversion . . . . . . . . . . . . . . . . . . 891
16.4.5 String Collation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 904
16.4.6 Internationalized Messages . . . . . . . . . . . . . . . . . . . . . . . . . 905
xx Contents
17 Numerics 907
17.1 RandomNumbers and Distributions. . . . . . . . . . . . . . . . . . . . . . . . . 907
17.1.1 A First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 908
17.1.2 Engines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 912
17.1.3 Enginesin Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 915
17.1.4 Distributions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 917
17.1.5 Distributionsin Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . 921
17.2 Complex Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 925
17.2.1 Classcomplex in General . . . . . . . . . . . . . . . . . . . . . . . . 925
17.2.2 Examples UsingClasscomplex . . . . . . . . . . . . . . . . . . . . . 926
17.2.3 Operationsfor Complex Numbers . . . . . . . . . . . . . . . . . . . . . 928
17.2.4 Classcomplex in Detail . . . . . . . . . . . . . . . . . . . . . . . . . 935
17.3 Global Numeric Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 941
17.4 Va l a r r a y s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943
18 Concurrency 945
18.1 The High-Level Interface: async() and Futures . . . . . . . . . . . . . . . . . . 946
18.1.1 A First Example Usingasync() and Futures . . . . . . . . . . . . . . . 946
18.1.2 AnExample of Waitingfor Two Tasks . . . . . . . . . . . . . . . . . . . 955
18.1.3 Shared Futures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 960
18.2 The Low-Level Interface: Threadsand Promises . . . . . . . . . . . . . . . . . . 964
18.2.1 Classstd::thread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 964
18.2.2 Promises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 969
18.2.3 Classpackaged_task . . . . . . . . . . . . . . . . . . . . . . . . . . 972
18.3 Startinga Thread in Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 973
18.3.1 async() in Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 974
18.3.2 Futuresin Detail. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 975
18.3.3 Shared Futuresin Detail. . . . . . . . . . . . . . . . . . . . . . . . . . . 976
18.3.4 Classstd::promise in Detail . . . . . . . . . . . . . . . . . . . . . . . 977
18.3.5 Classstd::packaged_task in Detail . . . . . . . . . . . . . . . . . . . 977
18.3.6 Classstd::thread in Detail . . . . . . . . . . . . . . . . . . . . . . . . 979
18.3.7 Namespace this_thread . . . . . . . . . . . . . . . . . . . . . . . . . 981
18.4 Synchronizing Threads, or the Problem of Concurrency . . . . . . . . . . . . . . 982
18.4.1 Bewareof Concurrency! . . . . . . . . . . . . . . . . . . . . . . . . . . 982
18.4.2 The Reason for the Problem of Concurrent Data Access . . . . . . . . . . 983
18.4.3 WhatExactlyCan GoWrong (the Extent of the Problem) . . . . . . . . . 983
18.4.4 The Features to Solvethe Problems . . . . . . . . . . . . . . . . . . . . . 987
Contents xxi
18.5 Mutexesand Locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 989
18.5.1 UsingMutexesand Locks . . . . . . . . . . . . . . . . . . . . . . . . . . 989
18.5.2 Mutexesand Locks in Detail . . . . . . . . . . . . . . . . . . . . . . . . 998
18.5.3 Calling Oncefor MultipleThreads . . . . . . . . . . . . . . . . . . . . . 1000
18.6 ConditionVa r i a b l e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1003
18.6.1 Purposeof ConditionVa r i a b l e s . . . . . . . . . . . . . . . . . . . . . . . 1003
18.6.2 A First Complete Example for ConditionVa r i a b l e s . . . . . . . . . . . . 1004
18.6.3 UsingConditionVa r i a b l e s to Implement a Queue for MultipleThreads . . 1006
18.6.4 ConditionVa r i a b l e s in Detail . . . . . . . . . . . . . . . . . . . . . . . . 1009
18.7 Atomics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1012
18.7.1 Example of UsingAtomics . . . . . . . . . . . . . . . . . . . . . . . . . 1012
18.7.2 Atomicsand TheirHigh-Level Interface in Detail . . . . . . . . . . . . . 1016
18.7.3 The C-StyleInterface of Atomics . . . . . . . . . . . . . . . . . . . . . . 1019
18.7.4 The Low-Level Interface of Atomics . . . . . . . . . . . . . . . . . . . . 1019
19 Allocators 1023
19.1 UsingAllocatorsas an Application Programmer . . . . . . . . . . . . . . . . . . 1023
19.2 A User-DefinedAllocator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1024
19.3 UsingAllocatorsas a LibraryProgrammer . . . . . . . . . . . . . . . . . . . . . 1026
Bibliography 1031
Newsgroups and Forums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1031
Books and Web Sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1032
Index 1037
This page intentionally left blank
UNIX高级环境编程(第三版)英文版+源代码+高清完整PDF版
Advanced Programming in the UNIX Environment 3rd Edition
UNIX高级环境编程(第三版)英文版+源代码+PDF
非扫描版,有目录。
Contents
Foreword to the Second Edition xix
Preface xxi
Preface to the Second Edition xxv
Preface to the First Edition xxix
Chapter 1. UNIX System Overview 1
1.1 Introduction 1
1.2 UNIX Architecture 1
1.3 Logging In 2
1.4 Files and Directories 4
1.5 Input and Output 8
1.6 Programs and Processes 10
1.7 Error Handling 14
1.8 User Identification 16
1.9 Signals 18
1.10 Time Values 20
1.11 System Calls and Library Functions 21
1.12 Summary 23
Chapter 2. UNIX Standardization and Implementations 25
2.1 Introduction 25
2.2 UNIX Standardization 25
2.2.1 ISO C 25
2.2.2 IEEE POSIX 26
2.2.3 The Single UNIX Specification 30
2.2.4 FIPS 32
2.3 UNIX System Implementations 33
2.3.1 UNIX System V Release 4 33
2.3.2 4.4BSD 34
2.3.3 FreeBSD 34
2.3.4 Linux 35
2.3.5 Mac OS X 35
2.3.6 Solaris 35
2.3.7 Other UNIX Systems 35
2.4 Relationship of Standards and Implementations 36
2.5 Limits 36
2.5.1 ISO C Limits 37
2.5.2 POSIX Limits 38
2.5.3 XSI Limits 41
2.5.4 sysconf, pathconf, and fpathconf Functions 42
2.5.5 Indeterminate Runtime Limits 49
2.6 Options 53
2.7 Feature Test Macros 57
2.8 Primitive System Data Types 58
2.9 Differences Between Standards 58
2.10 Summary 60
Chapter 3. File I/O 61
3.1 Introduction 61
3.2 File Descriptors 61
3.3 open and openat Functions 62
3.4 creat Function 66
3.5 close Function 66
3.6 lseek Function 66
3.7 read Function 71
3.8 write Function 72
3.9 I/O Efficiency 72
3.10 File Sharing 74
3.11 Atomic Operations 77
3.12 dup and dup2 Functions 79
3.13 sync, fsync, and fdatasync Functions 81
3.14 fcntl Function 82
3.15 ioctl Function 87
3.16 /dev/fd 88
3.17 Summary 90
Chapter 4. Files and Directories 93
4.1 Introduction 93
4.2 stat, fstat, fstatat, and lstat Functions 93
4.3 File Types 95
4.4 Set-User-ID and Set-Group-ID 98
4.5 File Access Permissions 99
4.6 Ownership of New Files and Directories 101
4.7 access and faccessat Functions 102
4.8 umask Function 104
4.9 chmod, fchmod, and fchmodat Functions 106
4.10 Sticky Bit 108
4.11 chown, fchown, fchownat, and lchown Functions 109
4.12 File Size 111
4.13 File Truncation 112
4.14 File Systems 113
4.15 link, linkat, unlink, unlinkat, and remove Functions 116
4.16 rename and renameat Functions 119
4.17 Symbolic Links 120
4.18 Creating and Reading Symbolic Links 123
4.19 File Times 124
4.20 futimens, utimensat, and utimes Functions 126
4.21 mkdir, mkdirat, and rmdir Functions 129
4.22 Reading Directories 130
4.23 chdir, fchdir, and getcwd Functions 135
4.24 Device Special Files 137
4.25 Summary of File Access Permission Bits 140
4.26 Summary 140
Chapter 5. Standard I/O Library 143
5.1 Introduction 143
5.2 Streams and FILE Objects 143
5.3 Standard Input, Standard Output, and Standard Error 145
5.4 Buffering 145
5.5 Opening a Stream 148
5.6 Reading and Writing a Stream 150
5.7 Line-at-a-Time I/O 152
5.8 Standard I/O Efficiency 153
5.9 Binary I/O 156
5.10 Positioning a Stream 157
5.11 Formatted I/O 159
5.12 Implementation Details 164
5.13 Temporary Files 167
5.14 Memory Streams 171
5.15 Alternatives to Standard I/O 174
5.16 Summary 175
Chapter 6. System Data Files and Information 177
6.1 Introduction 177
6.2 Password File 177
6.3 Shadow Passwords 181
6.4 Group File 182
6.5 Supplementary Group IDs 183
6.6 Implementation Differences 184
6.7 Other Data Files 185
6.8 Login Accounting 186
6.9 System Identification 187
6.10 Time and Date Routines 189
6.11 Summary 196
Chapter 7. Process Environment 197
7.1 Introduction 197
7.2 main Function 197
7.3 Process Termination 198
7.4 Command-Line Arguments 203
7.5 Environment List 203
7.6 Memory Layout of a C Program 204
7.7 Shared Libraries 206
7.8 Memory Allocation 207
7.9 Environment Variables 210
7.10 setjmp and longjmp Functions 213
7.11 getrlimit and setrlimit Functions 220
7.12 Summary 225
Chapter 8. Process Control 227
8.1 Introduction 227
8.2 Process Identifiers 227
8.3 fork Function 229
8.4 vfork Function 234
8.5 exit Functions 236
8.6 wait and waitpid Functions 238
8.7 waitid Function 244
8.8 wait3 and wait4 Functions 245
8.9 Race Conditions 245
8.10 exec Functions 249
8.11 Changing User IDs and Group IDs 255
8.12 Interpreter Files 260
8.13 system Function 264
8.14 Process Accounting 269
8.15 User Identification 275
8.16 Process Scheduling 276
8.17 Process Times 280
8.18 Summary 282
Chapter 9. Process Relationships 285
9.1 Introduction 285
9.2 Terminal Logins 285
9.3 Network Logins 290
9.4 Process Groups 293
9.5 Sessions 295
9.6 Controlling Terminal 296
9.7 tcgetpgrp, tcsetpgrp, and tcgetsid Functions 298
9.8 Job Control 299
9.9 Shell Execution of Programs 303
9.10 Orphaned Process Groups 307
9.11 FreeBSD Implementation 310
9.12 Summary 312
Chapter 10. Signals 313
10.1 Introduction 313
10.2 Signal Concepts 313
10.3 signal Function 323
10.4 Unreliable Signals 326
10.5 Interrupted System Calls 327
10.6 Reentrant Functions 330
10.7 SIGCLD Semantics 332
10.8 Reliable-Signal Terminology and Semantics 335
10.9 kill and raise Functions 336
10.10 alarm and pause Functions 338
10.11 Signal Sets 344
10.12 sigprocmask Function 346
10.13 sigpending Function 347
10.14 sigaction Function 349
10.15 sigsetjmp and siglongjmp Functions 355
10.16 sigsuspend Function 359
10.17 abort Function 365
10.18 system Function 367
10.19 sleep, nanosleep, and clock_nanosleep Functions 373
10.20 sigqueue Function 376
10.21 Job-Control Signals 377
10.22 Signal Names and Numbers 379
10.23 Summary 381
Chapter 11. Threads 383
11.1 Introduction 383
11.2 Thread Concepts 383
11.3 Thread Identification 384
11.4 Thread Creation 385
11.5 Thread Termination 388
11.6 Thread Synchronization 397
11.6.1 Mutexes 399
11.6.2 Deadlock Avoidance 402
11.6.3 pthread_mutex_timedlock Function 407
11.6.4 Reader-Writer Locks 409
11.6.5 Reader-Writer Locking with Timeouts 413
11.6.6 Condition Variables 413
11.6.7 Spin Locks 417
11.6.8 Barriers 418
11.7 Summary 422
Chapter 12. Thread Control 425
12.1 Introduction 425
12.2 Thread Limits 425
12.3 Thread Attributes 426
12.4 Synchronization Attributes 430
12.4.1 Mutex Attributes 430
12.4.2 Reader-Writer Lock Attributes 439
12.4.3 Condition Variable Attributes 440
12.4.4 Barrier Attributes 441
12.5 Reentrancy 442
12.6 Thread-Specific Data 446
12.7 Cancel Options 451
12.8 Threads and Signals 453
12.9 Threads and fork 457
12.10 Threads and I/O 461
12.11 Summary 462
Chapter 13. Daemon Processes 463
13.1 Introduction 463
13.2 Daemon Characteristics 463
13.3 Coding Rules 466
13.4 Error Logging 469
13.5 Single-Instance Daemons 473
13.6 Daemon Conventions 474
13.7 Client-Server Model 479
13.8 Summary 480
Chapter 14. Advanced I/O 481
14.1 Introduction 481
14.2 Nonblocking I/O 481
14.3 Record Locking 485
14.4 I/O Multiplexing 500
14.4.1 select and pselect Functions 502
14.4.2 poll Function 506
14.5 Asynchronous I/O 509
14.5.1 System V Asynchronous I/O 510
14.5.2 BSD Asynchronous I/O 510
14.5.3 POSIX Asynchronous I/O 511
14.6 readv and writev Functions 521
14.7 readn and writen Functions 523
14.8 Memory-Mapped I/O 525
14.9 Summary 531
Chapter 15. Interprocess Communication 533
15.1 Introduction 533
15.2 Pipes 534
15.3 popen and pclose Functions 541
15.4 Coprocesses 548
15.5 FIFOs 552
15.6 XSI IPC 556
15.6.1 Identifiers and Keys 556
15.6.2 Permission Structure 558
15.6.3 Configuration Limits 559
15.6.4 Advantages and Disadvantages 559
15.7 Message Queues 561
15.8 Semaphores 565
15.9 Shared Memory 571
15.10 POSIX Semaphores 579
15.11 Client-Server Properties 585
15.12 Summary 587
Chapter 16. Network IPC: Sockets 589
16.1 Introduction 589
16.2 Socket Descriptors 590
16.3 Addressing 593
16.3.1 Byte Ordering 593
16.3.2 Address Formats 595
16.3.3 Address Lookup 597
16.3.4 Associating Addresses with Sockets 604
16.4 Connection Establishment 605
16.5 Data Transfer 610
16.6 Socket Options 623
16.7 Out-of-Band Data 626
16.8 Nonblocking and Asynchronous I/O 627
16.9 Summary 628
Chapter 17. Advanced IPC 629
17.1 Introduction 629
17.2 UNIX Domain Sockets 629
17.2.1 Naming UNIX Domain Sockets 634
17.3 Unique Connections 635
17.4 Passing File Descriptors 642
17.5 An Open Server, Version 1 653
17.6 An Open Server, Version 2 659
17.7 Summary 669
Chapter 18. Terminal I/O 671
18.1 Introduction 671
18.2 Overview 671
18.3 Special Input Characters 678
18.4 Getting and Setting Terminal Attributes 683
18.5 Terminal Option Flags 683
18.6 stty Command 691
18.7 Baud Rate Functions 692
18.8 Line Control Functions 693
18.9 Terminal Identification 694
18.10 Canonical Mode 700
18.11 Noncanonical Mode 703
18.12 Terminal Window Size 710
18.13 termcap, terminfo, and curses 712
18.14 Summary 713
Chapter 19. Pseudo Terminals 715
19.1 Introduction 715
19.2 Overview 715
19.3 Opening Pseudo-Terminal Devices 722
19.4 pty_fork Function 726
19.5 pty Program 729
19.6 Using the pty Program 733
19.7 Advanced Features 740
19.8 Summary 741
Chapter 20. A Database Library 743
20.1 Introduction 743
20.2 History 743
20.3 The Library 744
20.4 Implementation Overview 746
20.5 Centralized or Decentralized? 750
20.6 Concurrency 752
20.7 Building the Library 753
20.8 Source Code 753
20.9 Performance 781
20.10 Summary 786
Chapter 21. Communicating with a Network Printer 789
21.1 Introduction 789
21.2 The Internet Printing Protocol 789
21.3 The Hypertext Transfer Protocol 792
21.4 Printer Spooling 793
21.5 Source Code 795
21.6 Summary 843
Appendix A. Function Prototypes 845
Appendix B. Miscellaneous Source Code 895
B.1 Our Header File 895
B.2 Standard Error Routines 898
Appendix C. Solutions to Selected Exercises 905
Bibliography 947
Index 955
更多内容请访问:
http://www.apuebook.com/
分区助手专业版4.0
用这工具里的EPW.exe把FAT32转换成NTFS后,再把C盘容量扩大啦
中文版,菜鸟级被用的。
智能提示我先把先把虚拟内存中D盘页面文件先清除再扩容
计算机组成原理(第2版)_唐朔飞
计算机组成原理(第二版)_唐朔飞
扫描版 共434页 2009年11月第6次印刷。
Linux那些事儿.rar
注:下载后,评价时给5星,还你11分
Linux那些事儿.rar
Linux那些事儿.rar
Linux那些事儿.rar
C语言程序设计(非扫描版).pdf
注:下载后,评价时给5星,还你11分
C语言程序设计.pdf
C语言程序设计.pdf
数据结构(C语言版).严蔚敏_吴伟民(最新版).pdf
注:下载后,评价时给5星,还你11分
数据结构(C语言版).严蔚敏_吴伟民.扫描版.zip
清华大学出版社
FVP密码查看工具FVP密码查看工具
注:下载后,评价时给5星,还你11分
FVP密码查看工具
能够查看网页中保留的密码*****
Red Hat Linux 9.0基础教程.zip
注:下载后,评价时给5星,还你11分
Red Hat Linux 9.0基础教程.zip
百度工具栏.zip 百度工具箱
注:下载后,评价时给5星,还你11分
用IE浏览器时,装上这个百度工具箱,可下载网页上的各种音频视频,非常方便!
完整版《数据结构1800题+答案》
注:下载后,评价时给5星,还你11分
完整版《数据结构1800题+答案》
Linux完整教程(初级教程).CHM
注:下载后,评价时给5星,还你11分
全部来网上论坛精华!
IBM.PC.汇编语言程序设计(第五版)完整版.pdf
注:下载后,评价时给5星,还你11分
注:下载后,评价时给5星,还你11分
注:下载后,评价时给5星,还你11分
The C programming Language.chm
注:下载后,评价时给5星,还你11分
Contents
Preface
Preface to the first edition
Introduction
Chapter 1: A Tutorial Introduction
Getting Started
Variables and Arithmetic Expressions
The for statement
Symbolic Constants
Character Input and Output
File Copying
Character Counting
Line Counting
Word Counting
Arrays
Functions
Arguments - Call by Value
Character Arrays
External Variables and Scope
Chapter 2: Types, Operators and Expressions
Variable Names
Data Types and Sizes
Constants
Declarations
Arithmetic Operators
Relational and Logical Operators
Type Conversions
Increment and Decrement Operators
Bitwise Operators
Assignment Operators and Expressions
Conditional Expressions
Precedence and Order of Evaluation
Chapter 3: Control Flow
Statements and Blocks
If-Else
Else-If
Switch
Loops - While and For
Loops - Do-While
Break and Continue
Goto and labels
Chapter 4: Functions and Program Structure
Basics of Functions
Functions Returning Non-integers
External Variables
Scope Rules
Header Files
Static Variables
Register Variables
Block Structure
Initialization
Recursion
The C Preprocessor
File Inclusion
Macro Substitution
Conditional Inclusion
Chapter 5: Pointers and Arrays
Pointers and Addresses
Pointers and Function Arguments
Pointers and Arrays
Address Arithmetic
Character Pointers and Functions
Pointer Arrays; Pointers to Pointers
Multi-dimensional Arrays
Initialization of Pointer Arrays
Pointers vs. Multi-dimensional Arrays
Command-line Arguments
Pointers to Functions
Complicated Declarations
Chapter 6: Structures
Basics of Structures
Structures and Functions
Arrays of Structures
Pointers to Structures
Self-referential Structures
Table Lookup
Typedef
Unions
Bit-fields
Chapter 7: Input and Output
Standard Input and Output
Formatted Output - printf
Variable-length Argument Lists
Formatted Input - Scanf
File Access
Error Handling - Stderr and Exit
Line Input and Output
Miscellaneous Functions
String Operations
Character Class Testing and Conversion
Ungetc
Command Execution
Storage Management
Mathematical Functions
Random Number generation
Chapter 8: The UNIX System Interface
File Descriptors
Low Level I/O - Read and Write
Open, Creat, Close, Unlink
Random Access - Lseek
Example - An implementation of Fopen and Getc
Example - Listing Directories
Example - A Storage Allocator
Appendix A: Reference Manual
Introduction
Lexical Conventions
Syntax Notation
Meaning of Identifiers
Objects and Lvalues
Conversions
Expressions
Declarations
Statements
External Declarations
Scope and Linkage
Preprocessor
Grammar
Appendix B: Standard Library
Input and Output: <stdio.h>
File Operations
Formatted Output
Formatted Input
Character Input and Output Functions
Direct Input and Output Functions
File Positioning Functions
Error Functions
Character Class Tests: <ctype.h>
String Functions: <string.h>
Mathematical Functions: <math.h>
Utility Functions: <stdlib.h>
Diagnostics: <assert.h>
Variable Argument Lists: <stdarg.h>
Non-local Jumps: <setjmp.h>
Signals: <signal.h>
Date and Time Functions: <time.h>
Implementation-defined Limits: <limits.h> and <float.h>
数学建模竞赛教程.pdf
注:下载后,评价时给5星,还你11分
很经典的一本数模教材!
Dos2Win.CHM
Dos2Win.CHM
Dos2Win.CHM
Dos2Win.CHM
Dos2Win.CHM
汇编程序设计教程.chm
注:下载后,评价时给5星,还你11分
课程介绍
第1章 预备知识
1.1 汇编语言的由来及其特点
1 机器语言
2 汇编语言
3 汇编程序
4 汇编语言的主要特点
5 汇编语言的使用领域
1.2 数据的表示和类型
1 数值数据的表示
2 非数值数据的表示
3 基本的数据类型
1.3 习题
第2章 CPU资源和存储器
2.1 寄存器组
1 寄存器组
2 通用寄存器的作用
3 专用寄存器的作用
2.2 存储器的管理模式
1 16位微机的内存管理模式
2 32位微机的内存管理模式
2.3 习题
第3章 操作数的寻址方式
3.1 立即寻址方式
3.2 寄存器寻址方式
3.3 直接寻址方式
3.4 寄存器间接寻址方式
3.5 寄存器相对寻址方式
3.6 基址加变址寻址方式
3.7 相对基址加变址寻址方式
3.8 32位地址的寻址方式
3.9 操作数寻址方式的小结
3.10 习题
第4章 标识符和表达式
4.1 标识符
4.2 简单内存变量的定义
1 内存变量定义的一般形式
2 字节变量
3 字变量
4 双字变量
5 六字节变量
6 八字节变量
7 十字节变量
4.3 调整偏移量伪指令
1 偶对齐伪指令
2 对齐伪指令
3 调整偏移量伪指令
4 偏移量计数器的值
4.4 复合内存变量的定义
1 重复说明符
2 结构类型的定义
3 联合类型的定义
4 记录类型的定义
5 数据类型的自定义
4.5 标号
4.6 内存变量和标号的属性
1 段属性操作符
2 偏移量属性操作符
3 类型属性操作符
4 长度属性操作符
5 容量属性操作符
6 强制属性操作符
7 存储单元别名操作符
4.7 表达式
1 进制伪指令
2 数值表达式
3 地址表达式
4.8 符号定义语句
1 等价语句
2 等号语句
3 符号名定义语句
4.9 习题
第5章 微机CPU的指令系统
5.1 汇编语言指令格式
1 指令格式
2 了解指令的几个方面
5.2 指令系统
1 数据传送指令
2 标志位操作指令
3 算术运算指令
4 逻辑运算指令
5 移位操作指令
6 位操作指令
7 比较运算指令
8 循环指令
9 转移指令
10 条件设置字节指令
11 字符串操作指令
12 ASCII-BCD码调整指令
13 处理器指令
5.3 习题
第6章 程序的基本结构
6.1 程序的基本组成
1 段的定义
2 段寄存器的说明语句
3 堆栈段的说明
4 源程序的结构
6.2 程序的基本结构
1 顺序结构
2 分支结构
3 循环结构
6.3 段的基本属性
1 对齐类型
2 组合类型
3 类别
4 段组
6.4 简化的段定义
1 存储模型说明伪指令
2 简化段定义伪指令
3 简化段段名的引用
6.5 源程序的辅助说明伪指令
1 模块名定义伪指令
2 页面定义伪指令
3 标题定义伪指令
4 子标题定义伪指令
6.6 习题
第7章 子程序和库
7.1 子程序的定义
7.2 子程序的调用和返回指令
1 调用指令
2 返回指令
7.3 子程序的参数传递
1 寄存器传递参数
2 存储单元传递参数
3 堆栈传递参数
7.4 寄存器的保护与恢复
7.5 子程序的完全定义
1 子程序完全定义格式
2 子程序的位距
3 子程序的语言类型
4 子程序的可见性
5 子程序的起始和结束操作
6 寄存器的保护和恢复
7 子程序的参数传递
8 子程序的原型说明
9 子程序的调用伪指令
10 局部变量的定义
7.6 子程序库
1 建立库文件命令
2 建立库文件举例
3 库文件的应用
4 库文件的好处
7.7 习题
第8章 输入输出和中断
8.1 输入输出的基本概念
1 I/O端口地址
2 I/O指令
8.2 中断
1 中断的基本概念
2 中断指令
3 中断返回指令
4 中断和子程序
8.3 中断的分类
1 键盘输入的中断功能
2 屏幕显示的中断功能
3 打印输出的中断功能
4 串行通信口的中断功能
5 鼠标的中断功能
6 目录和文件的中断功能
7 内存管理的中断功能
8 读取和设置中断向量
8.4 习题
第9章 宏
9.1 宏的定义和引用
1 宏的定义
2 宏的引用
3 宏的参数传递方式
4 宏的嵌套定义
5 宏与子程序的区别
9.2 宏参数的特殊运算符
1 连接运算符
2 字符串整体传递运算符
3 字符转义运算符
4 计算表达式运算符
9.3 与宏有关的伪指令
1 局部标号伪指令
2 取消宏定义伪指令
3 中止宏扩展伪指令
9.4 重复汇编伪指令
1 伪指令REPT
2 伪指令IRP
3 伪指令IRPC
9.5 条件汇编伪指令
1 条件汇编伪指令的功能
2 条件汇编伪指令的举例
9.6 宏的扩充
1 宏定义形式
2 重复伪指令REPEAT
3 循环伪指令WHILE
4 循环伪指令FOR
5 循环伪指令FORC
6 转移伪指令GOTO
7 宏扩充的举例
8 系统定义的宏
9.7 习题
第10章 应用程序的设计
10.1 字符串的处理程序
10.2 数据的分类统计程序
10.3 数据转换程序
10.4 文件操作程序
10.5 动态数据的编程
10.6 COM文件的编程
10.7 驻留程序
10.8 程序段前缀及其应用
1 程序段前缀的字段含义
2 程序段前缀的应用
10.9 习题
第11章 数值运算协处理器
11.1 协处理器的数据格式
1 有符号整数
2 BCD码数据
3 浮点数
11.2 协处理器的结构
11.3 协处理器的指令系统
1 操作符的命名规则
2 数据传送指令
3 数学运算指令
4 比较运算指令
5 超越函数运算指令
6 常数操作指令
7 协处理器控制指令
11.4 协处理器的编程举例
11.5 习题
第12章 汇编语言和C语言
12.1 汇编语言的嵌入
12.2 C语言程序的汇编输出
12.3 一个具体的例子
12.4 习题
附录
[麻省理工学院-算法导论](英文版).chm
注:下载后,评价时给5星,还你11分
Table of Contents
Introduction to Algorithms, Second Edition
Preface
Part I - Foundations
Chapter 1 - The Role of Algorithms in Computing
Chapter 2 - Getting Started
Chapter 3 - Growth of Functions
Chapter 4 - Recurrences
Chapter 5 - Probabilistic Analysis and Randomized Algorithms
Part II - Sorting and Order Statistics
Chapter 6 - Heapsort
Chapter 7 - Quicksort
Chapter 8 - Sorting in Linear Time
Chapter 9 - Medians and Order Statistics
Part III - Data Structures
Chapter 10 - Elementary Data Structures
Chapter 11 - Hash Tables
Chapter 12 - Binary Search Trees
Chapter 13 - Red-Black Trees
Chapter 14 - Augmenting Data Structures
Part IV - Advanced Design and Analysis Techniques
Chapter 15 - Dynamic Programming
Chapter 16 - Greedy Algorithms
Chapter 17 - Amortized Analysis
Part V - Advanced Data Structures
Chapter 18 - B-Trees
Chapter 19 - Binomial Heaps
Chapter 20 - Fibonacci Heaps
Chapter 21 - Data Structures for Disjoint Sets
Part VI - Graph Algorithms
Chapter 22 - Elementary Graph Algorithms
Chapter 23 - Minimum Spanning Trees
Chapter 24 - Single-Source Shortest Paths
Chapter 25 - All-Pairs Shortest Paths
Chapter 26 - Maximum Flow
Part VII - Selected Topics
Chapter 27 - Sorting Networks
Chapter 28 - Matrix Operations
Chapter 29 - Linear Programming
Chapter 30 - Polynomials and the FFT
Chapter 31 - Number-Theoretic Algorithms
Chapter 32 - String Matching
Chapter 33 - Computational Geometry
Chapter 34 - NP-Completeness
Chapter 35 - Approximation Algorithms
Part VIII - Appendix: Mathematical Background
Appendix A - Summations
Appendix B - Sets, Etc.
Appendix C - Counting and Probability
Bibliography
Index
List of Figures
List of Corollaries
List of Problems
List of Exercises
UNIX环境高级编程.pdf
注:下载后,评价时给5星,还你11分
第1章U N I X基础知识
第2章U N I X标准化及实现
第3章文件I / O
第4章文件和目录
第5章标准I/O 库
第6章系统数据文件和信息
第7章U N I X进程的环境
第8章进程控制
第9章进程关系
第10章信号
第11章终端I / O
第1 2章高级I / O
第1 3章精灵进程
第1 4章进程间通信
第1 5章高级进程间通信
第1 6章数据库函数库
第1 7章与PostScript 打印机通信
第1 8章调制解调器拨号器
第1 9章伪终端
多线程编程指南.pdf
注:下载后,评价时给5星,还你11分
前言.......................................................................................................................................................11
1 多线程基础介绍.................................................................................................................................15
定义多线程术语................................................................................................................................ 15
符合多线程标准................................................................................................................................ 16
多线程的益处.................................................................................................................................... 17
提高应用程序的响应................................................................................................................. 17
有效使用多处理器..................................................................................................................... 17
改进程序结构.............................................................................................................................. 17
占用较少的系统资源................................................................................................................. 17
结合线程和RPC(远程过程调用) ...................................................................................... 18
多线程概念......................................................................................................................................... 18
并发性和并行性......................................................................................................................... 18
多线程结构一览......................................................................................................................... 18
线程调度..................................................................................................................................... 19
线程取消..................................................................................................................................... 19
线程同步..................................................................................................................................... 20
使用64 位体系结构........................................................................................................................... 20
2 基本线程编程.....................................................................................................................................23
线程库................................................................................................................................................. 23
创建缺省线程.............................................................................................................................. 23
等待线程终止.............................................................................................................................. 25
简单线程的示例......................................................................................................................... 26
分离线程..................................................................................................................................... 28
为线程特定数据创建键............................................................................................................ 29
删除线程特定数据键................................................................................................................. 30
3
设置线程特定数据..................................................................................................................... 31
获取线程特定数据..................................................................................................................... 32
获取线程标识符......................................................................................................................... 36
比较线程ID ................................................................................................................................ 36
初始化线程................................................................................................................................. 37
停止执行线程.............................................................................................................................. 38
设置线程的优先级..................................................................................................................... 38
获取线程的优先级..................................................................................................................... 39
向线程发送信号......................................................................................................................... 40
访问调用线程的信号掩码........................................................................................................ 41
安全地Fork ................................................................................................................................. 42
终止线程..................................................................................................................................... 42
结束.............................................................................................................................................. 43
取消线程..................................................................................................................................... 43
取消线程..................................................................................................................................... 45
启用或禁用取消功能................................................................................................................. 45
设置取消类型.............................................................................................................................. 46
创建取消点................................................................................................................................. 47
将处理程序推送到栈上............................................................................................................ 48
从栈中弹出处理程序................................................................................................................. 48
3 线程属性..............................................................................................................................................51
属性对象............................................................................................................................................. 51
初始化属性................................................................................................................................. 52
销毁属性..................................................................................................................................... 53
设置分离状态.............................................................................................................................. 54
获取分离状态.............................................................................................................................. 55
设置栈溢出保护区大小............................................................................................................ 56
获取栈溢出保护区大小............................................................................................................ 57
设置范围..................................................................................................................................... 58
获取范围..................................................................................................................................... 59
设置线程并行级别..................................................................................................................... 60
获取线程并行级别..................................................................................................................... 60
设置调度策略.............................................................................................................................. 61
获取调度策略.............................................................................................................................. 62
目录
4 多线程编程指南• 2006年10月
设置继承的调度策略................................................................................................................. 63
获取继承的调度策略................................................................................................................. 64
设置调度参数.............................................................................................................................. 64
获取调度参数.............................................................................................................................. 65
设置栈大小................................................................................................................................. 67
获取栈大小................................................................................................................................. 68
关于栈.......................................................................................................................................... 69
设置栈地址和大小..................................................................................................................... 71
获取栈地址和大小..................................................................................................................... 73
4 用同步对象编程.................................................................................................................................75
互斥锁属性......................................................................................................................................... 76
初始化互斥锁属性对象............................................................................................................ 77
销毁互斥锁属性对象................................................................................................................. 78
设置互斥锁的范围..................................................................................................................... 79
获取互斥锁的范围..................................................................................................................... 80
设置互斥锁类型的属性............................................................................................................ 80
获取互斥锁的类型属性............................................................................................................ 82
设置互斥锁属性的协议............................................................................................................ 82
获取互斥锁属性的协议............................................................................................................ 84
设置互斥锁属性的优先级上限............................................................................................... 85
获取互斥锁属性的优先级上限............................................................................................... 86
设置互斥锁的优先级上限........................................................................................................ 87
获取互斥锁的优先级上限........................................................................................................ 88
设置互斥锁的强健属性............................................................................................................ 89
获取互斥锁的强健属性............................................................................................................ 90
使用互斥锁......................................................................................................................................... 91
初始化互斥锁.............................................................................................................................. 92
使互斥保持一致......................................................................................................................... 93
锁定互斥锁................................................................................................................................. 94
解除锁定互斥锁......................................................................................................................... 96
使用非阻塞互斥锁锁定............................................................................................................ 97
销毁互斥锁................................................................................................................................. 98
互斥锁定的代码示例................................................................................................................. 99
条件变量属性.................................................................................................................................. 105
目录
5
初始化条件变量属性............................................................................................................... 106
删除条件变量属性................................................................................................................... 106
设置条件变量的范围............................................................................................................... 107
获取条件变量的范围............................................................................................................... 108
使用条件变量.................................................................................................................................. 109
初始化条件变量....................................................................................................................... 109
基于条件变量阻塞................................................................................................................... 111
解除阻塞一个线程................................................................................................................... 112
在指定的时间之前阻塞.......................................................................................................... 114
在指定的时间间隔内阻塞...................................................................................................... 116
解除阻塞所有线程................................................................................................................... 117
销毁条件变量状态................................................................................................................... 119
唤醒丢失问题............................................................................................................................ 120
生成方和使用者问题............................................................................................................... 120
使用信号进行同步.......................................................................................................................... 124
命名信号和未命名信号.......................................................................................................... 125
计数信号量概述....................................................................................................................... 125
初始化信号............................................................................................................................... 126
增加信号................................................................................................................................... 128
基于信号计数进行阻塞.......................................................................................................... 129
减小信号计数............................................................................................................................ 129
销毁信号状态............................................................................................................................ 130
使用信号时的生成方和使用者问题.................................................................................... 131
读写锁属性....................................................................................................................................... 133
初始化读写锁属性................................................................................................................... 134
销毁读写锁属性....................................................................................................................... 134
设置读写锁属性....................................................................................................................... 135
获取读写锁属性....................................................................................................................... 136
使用读写锁....................................................................................................................................... 136
初始化读写锁............................................................................................................................ 137
获取读写锁中的读锁............................................................................................................... 138
读取非阻塞读写锁中的锁...................................................................................................... 139
写入读写锁中的锁................................................................................................................... 139
写入非阻塞读写锁中的锁...................................................................................................... 140
解除锁定读写锁....................................................................................................................... 140
销毁读写锁............................................................................................................................... 141
目录
6 多线程编程指南• 2006年10月
跨进程边界同步............................................................................................................................... 142
生成方和使用者问题示例...................................................................................................... 142
比较元语........................................................................................................................................... 145
5 使用Solaris 软件编程......................................................................................................................147
进程创建中的fork 问题................................................................................................................. 147
Fork-One 模型........................................................................................................................... 148
Fork-all 模型.............................................................................................................................. 151
选择正确的Fork ....................................................................................................................... 151
进程创建:exec 和exit 问题....................................................................................................... 152
计时器、报警与剖析...................................................................................................................... 152
每LWP POSIX 计时器............................................................................................................. 152
每线程报警............................................................................................................................... 153
剖析多线程程序....................................................................................................................... 153
非本地转向:setjmp 和longjmp .................................................................................................. 154
资源限制........................................................................................................................................... 154
LWP 和调度类................................................................................................................................. 154
分时调度................................................................................................................................... 155
实时调度................................................................................................................................... 155
公平共享调度程序................................................................................................................... 155
固定优先级调度....................................................................................................................... 156
扩展传统信号.................................................................................................................................. 156
同步信号................................................................................................................................... 157
异步信号................................................................................................................................... 157
延续语义................................................................................................................................... 157
对信号执行的操作................................................................................................................... 158
定向于线程的信号................................................................................................................... 160
完成语义................................................................................................................................... 162
信号处理程序和异步信号安全............................................................................................. 163
中断对条件变量的等待.......................................................................................................... 165
I/O 问题............................................................................................................................................. 166
I/O 作为远程过程调用............................................................................................................ 167
人为的异步性............................................................................................................................ 167
异步I/O ..................................................................................................................................... 167
共享的I/O 和新的I/O 系统调用.......................................................................................... 169
目录
7
getc 和putc 的替代项............................................................................................................. 169
6 安全和不安全的接口...................................................................................................................... 171
线程安全........................................................................................................................................... 171
MT接口安全级别............................................................................................................................ 173
不安全接口的可重复执行函数............................................................................................. 174
异步信号安全函数.......................................................................................................................... 175
库的MT安全级别........................................................................................................................... 175
不安全库................................................................................................................................... 176
7 编译和调试....................................................................................................................................... 177
编译多线程应用程序...................................................................................................................... 177
为编译做准备............................................................................................................................ 177
选择Solaris 语义或POSIX 语义............................................................................................ 178
包括<thread.h> 或<pthread.h> .......................................................................................... 178
定义_REENTRANT 或_POSIX_C_SOURCE .................................................................................. 179
使用libthread 或libpthread 链接..................................................................................... 179
与POSIX 信号的-lrt 链接.................................................................................................... 181
将原有模块与新模块链接...................................................................................................... 181
备用线程库....................................................................................................................................... 181
调试多线程程序............................................................................................................................... 181
多线程程序中常见的疏忽性问题......................................................................................... 181
使用TNF 实用程序跟踪和调试............................................................................................ 182
使用truss ................................................................................................................................. 182
使用mdb ..................................................................................................................................... 182
使用dbx ..................................................................................................................................... 183
8 Solaris 线程编程...............................................................................................................................185
比较Solaris 线程和POSIX 线程的API ....................................................................................... 185
API 的主要差异........................................................................................................................ 185
函数比较表............................................................................................................................... 186
Solaris 线程的独有函数.................................................................................................................. 189
暂停执行线程............................................................................................................................ 190
继续执行暂停的线程............................................................................................................... 191
目录
8 多线程编程指南• 2006年10月
相似的同步函数-读写锁............................................................................................................. 192
初始化读写锁............................................................................................................................ 192
获取读锁................................................................................................................................... 194
尝试获取读锁............................................................................................................................ 194
获取写锁................................................................................................................................... 195
尝试获取写锁............................................................................................................................ 196
解除锁定读写锁....................................................................................................................... 196
销毁读写锁的状态................................................................................................................... 197
相似的Solaris 线程函数................................................................................................................. 199
创建线程................................................................................................................................... 199
获取最小栈大小....................................................................................................................... 201
获取线程标识符....................................................................................................................... 202
停止执行线程............................................................................................................................ 202
向线程发送信号....................................................................................................................... 203
访问调用线程的信号掩码...................................................................................................... 203
终止线程................................................................................................................................... 204
等待线程终止............................................................................................................................ 204
创建线程特定的数据键.......................................................................................................... 206
设置线程特定的数据值.......................................................................................................... 207
获取线程特定的数据值.......................................................................................................... 208
设置线程的优先级................................................................................................................... 208
获取线程的优先级................................................................................................................... 210
相似的同步函数-互斥锁............................................................................................................. 210
初始化互斥锁............................................................................................................................ 210
销毁互斥锁............................................................................................................................... 213
获取互斥锁............................................................................................................................... 213
释放互斥锁............................................................................................................................... 214
尝试获取互斥锁....................................................................................................................... 214
相似的同步函数:条件变量......................................................................................................... 215
初始化条件变量....................................................................................................................... 215
销毁条件变量............................................................................................................................ 216
等待条件................................................................................................................................... 217
等待绝对时间............................................................................................................................ 218
等待时间间隔............................................................................................................................ 218
解除阻塞一个线程................................................................................................................... 219
解除阻塞所有线程................................................................................................................... 220
目录
9
相似的同步函数:信号.................................................................................................................. 220
初始化信号............................................................................................................................... 220
增加信号................................................................................................................................... 222
基于信号计数阻塞................................................................................................................... 222
减小信号计数............................................................................................................................ 223
销毁信号状态............................................................................................................................ 224
跨进程边界同步............................................................................................................................... 224
生成方和使用者问题示例...................................................................................................... 224
fork() 和Solaris 线程的特殊问题................................................................................................ 227
9 编程原则........................................................................................................................................... 229
重新考虑全局变量.......................................................................................................................... 229
提供静态局部变量.......................................................................................................................... 230
同步线程........................................................................................................................................... 231
单线程策略............................................................................................................................... 232
可重复执行函数....................................................................................................................... 232
避免死锁........................................................................................................................................... 234
与调用相关的死锁................................................................................................................... 235
锁定原则................................................................................................................................... 235
线程代码的一些基本原则............................................................................................................. 236
创建和使用线程............................................................................................................................... 236
使用多处理器.................................................................................................................................. 237
基础体系结构............................................................................................................................ 237
线程程序示例.................................................................................................................................. 241
需要进一步阅读的内容.......................................................................................................... 241
A 样例应用程序:多线程grep .........................................................................................................243
tgrep 的说明.................................................................................................................................... 243
B Solaris 线程示例: barrier.c ........................................................................................................301
索引.................................................................................................................................................... 311
VI使用完全教程.pdf
注:下载后,评价时给5星,还你11分
图解vi使用,非常适合初学者!
LINUX入门的好资料
Linux Socket Programming by Example
TABLE OF CONTENTS
Introduction 1
Part 1
Basic Socket Concepts
5
1
Introducing Sockets
7
A Brief Historical Introduction 8
Understanding Sockets 9
Defining a Socket 9
Using Sockets 10
Referencing Sockets 11
Comparing Sockets to Pipes 12
Creating Sockets 13
Using socketpair(2) in an Example 14
Running the Demonstration Program 16
Performing I/O on Sockets 17
Closing Sockets 21
The shutdown(2) Function 22
Shutting Down Writing to a Socket 22
Dealing with Duplicated Sockets 23
Shutting Down Reading from a Socket 24
Knowing When Not to Use shutdown(2) 24
Writing a Client/Server Example 24
2
Domains and Address Families
35
Nameless Sockets 36
Anonymous Calls 36
Generating Addresses 36
Understanding Domains 36
Forming Socket Addresses 37
Examining the Generic Socket Address 37
Forming Local Addresses 38
Forming Traditional Local Addresses 39
Forming Abstract Local Addresses 44
Forming Internet (IPv4) Socket Addresses 47
Understanding Network Byte Order 49
Performing Endian Conversions 50
Page v
Initializing a Wild Internet Address 51
Initializing a Specific Internet Address 52
Specifying an X.25 Address 55
Specifying Other Address Families 58
The AF_UNSPEC Address Family 61
3
Address Conversion Functions
65
Internet IP Numbers 66
Internet Address Classes 66
Understanding Netmask Values 67
Allocating IP Addresses 72
Private IP Numbers 72
Reserved IP Numbers 73
Manipulating IP Numbers 73
Using the inet_addr(3) Function 73
The inet_aton(3) Function 77
Using the inet_ntoa(3) Function 80
Using inet_network(3) 83
Using the inet_lnaof(3) Function 85
Using the inet_netof(3) Function 86
Using the inet_makeaddr(3) Function 87
4
Socket Types and Protocols
93
Specifying the Domain of a Socket 94
Choosing PF_INET or AF_INET 94
Using the PF_LOCAL and AF_LOCAL Macros 95
Using the socket(2) Function 96
Choosing a Socket Type 96
Understanding the SOCK_STREAM Socket
Type
97
Understanding the SOCK_DGRAM Socket Type 99
Understanding the SOCK_SEQPACKET Socket Type 100
Choosing a Protocol 101
Using PF_LOCAL and SOCK_STREAM 102
Using PF_LOCAL and SOCK_DGRAM 103
Using PF_INET and SOCK_STREAM 103
Using PF_INET and SOCK_DGRAM 105
Socket Domain and Type Summary 106
Other Linux-Supported Protocols 107
Researching Other Protocols 109
Page vi
5
Binding Addresses to a Socket
115
The Purpose of the bind(2) Function 116
Using the bind(2) Function 116
Obtaining the Socket Address 120
Writing a sock_addr() Function 121
Obtaining a Peer Socket Address 125
Interfaces and Addressing 128
Specifying an Interface Address Example 128
Binding a Specific Interface Address 129
Binding for Any Interface 130
6
Connectionless-Oriented Protocols
133
The Methods of Communication 134
Understanding the Advantages 134
Understanding the Disadvantages of Connectionless
Communications
135
Performing Input/Output of Datagrams 136
Introducing the sendto(2) Function 136
Introducing the recvfrom(2) Function 138
Writing a UDP Datagram Server 140
Writing a UDP Datagram Client 146
Testing the Datagram Client and Server 150
Testing with No Server 152
TEAMFLY
Team-Fly®
Testing with Other IP Numbers 153
Leaving out bind(2) in Client Programs 154
Replying to a Wild Address 154
7
Connection-Oriented Protocols for Clients
159
Reviewing the Methods of Communication 160
TCP/IP Handles Lost Packets 160
TCP/IP Handles Duplicated Packets 161
TCP/IP Handles Sequencing 161
TCP/IP Handles Flow Control 161
Understanding the Advantages of TCP/IP 161
Internet Services 162
Examining the /etc/services File 162
Using Function getservent(3) 163
Using the setservent(3) Function 166
Using the endservent(3) Function 167
Page vii
Looking up a Service by Name and Protocol 167
Looking up a Service by Port and Protocol 168
Consulting the /etc/protocols File 168
Using the setprotoent(3) Function 171
Using the endprotoent(3) Function 172
Looking up a Protocol by Name 172
Looking up a Protocol by Number 172
Writing a TCP/IP Client Program 173
Introducing the connect(2) Function 173
Preparing to Write the Client Program 174
The daytime Client Program 176
Using connect(2) on SOCK_DGRAM Sockets 180
8
Connection-Oriented Protocols for Servers
183
Understanding the Role of the Server 184
The listen(2) Function 185
Understanding the Connect Queue 186
Specifying a Value for backlog 187
The accept(2) Function Call 188
Understanding the Role of accept(2) 189
Writing a TCP/IP Server 190
Running a Wild Server 196
Modifying the Client Program 197
9
Hostname and Network Name Lookups
203
Understanding the Need for Names 204
Using the uname(2) Function 204
Obtaining Hostnames and Domain Names 207
Using Function gethostname 207
Using the getdomainname(2) Function 208
Testing gethostname(2) and getdomainname(2) 208
Resolving Remote Addresses 210
Error Reporting 210
Reporting an h_errno Error 211
Using the gethostbyname(3) Function 212
Applying the gethostbyname(3) Function 214
The gethostbyaddr(3) Function 217
Using the sethostent(3) Function 223
Using the endhostent(3) Function 224
Page viii
Part 2
Advanced Socket Programming
227
10
Using Standard I/O on Sockets
229
Understanding the Need for Standard I/O 230
Associating a Socket with a Stream 230
Using fdopen(3) to Associate a Socket with a Stream 231
Closing a Socket Stream 232
Using Separate Read and Write Streams 233
Duplicating a Socket 234
Closing the Dual Streams 234
Winding up Communications 235
Shutting Down the Write Side Only 235
Shutting Down the Read Side Only 237
Shutting Down Both Read and Write Sides 237
Handling Interrupts 238
Handling EINTR for Other Functions 240
Denning Buffer Operation 240
Applying FILE Streams to Sockets 243
Presenting the mkaddr() Function 243
The RPN Calculator Engine Code 249
Trying out the RPN Server 264
11
Concurrent Client Servers
269
Understanding the Multiple-Client Problem 270
Overview of Server Functions 271
Using fork(2) to Service Multiple Clients 275
Understanding the Overall Server Process 280
Understanding the Child Server Process Flow 281
Understanding Process Termination Processing 282
Designing Servers That Use select(2) 282
Introducing the select(2) Function 283
Manipulating File Descriptor Sets 285
Applying select(2) to a Server 287
Testing the select(2) -Based Server 299
Limitations of the Example 301
12
Socket Options
305
Getting Socket Options 306
Applying getsockopt(2) 307
Page ix
Setting Socket Options 310
Applying the setsockopt(2) Function 311
Retrieving the Socket Type (SO_TYPE) 315
Setting the SO_REUSEADDR Option 317
Setting the SO_LINGER Option 320
Setting the SO_KEEPALIVE Option 323
Setting the SO_BROADCAST Option 324
Setting the SO_OOBINLINE Option 325
Options SO_PASSCRED and SO_PEERCRED 326
13
Broadcasting with UDP
329
Understanding Broadcast Addresses 330
Broadcasting on 255.255.255.255 330
Enhancing the mkaddr.c Subroutine 331
Broadcasting from a Server 332
Receiving Broadcasts 338
Demonstrating the Broadcasts 342
Broadcasting to a Network 343
Starting Broadcasts 343
Receiving Broadcasts 345
Receiving Broadcasts from a Remote Host 345
Troubleshooting Hints 346
14
Out-of-Band Data
349
Defining Out-of-Band 350
Understanding the Need for Out-of-Band Data 350
Sockets and Out-of-Band Data 351
Variations in Implementation 351
Using Out-of-Band Data 353
Writing Out-of-Band Data 353
Reading Out-of-Band Data 354
Understanding the Signal SIGURG 355
Supporting Subprograms 356
Receiving with the SIGURG Signal 359
Sending Out-of-Band Data 362
Testing the oobrecv and oobsend Programs 365
Page x
Understanding the Urgent Pointer 366
Understanding TCP Urgent Mode 366
Urgent Mode When tcp_stdurg=1 369
Receiving Out-of-Band Data Inline 370
Determining the Urgent Pointer 370
Using Out-of-Band Data Inline 371
Limitations of the Urgent Mode Pointer 375
Processing Out-of-Band Data with select(2) 377
15
Using the inetd Daemon
379
Steps Common to Most Servers 380
Introducing inetd 380
The /etc/inetd.conf Configuration File 381
The Design Parameters of inetd Servers 383
Implementing a Simple stream tcp Server 384
Configuring /etc/inetd.conf to Invoke a New Server 385
Disabling the New Service 389
Datagram Servers with inetd 389
Understanding wait and nowait 390
16
Network Security Programming
393
Defining Security 394
The Challenges of Security 394
Identifying Friend or Foe 396
Securing by Hostname or Domain Name 396
Identifying by IP Number 397
Securing inetd Servers 398
Centralized Network Policy 399
Understanding the TCP Wrapper Concept 399
Determining Access 401
Installing Wrapper and Server Programs 403
Examining Server and Wrapper Logging Code 403
Examining the Datagram Server Code 405
Examining the Simple TCP Wrapper Program 410
Introducing the Client Program 414
Installing and Testing the Wrapper 418
Monitoring the Log Files 419
Starting Your inetd Daemon 419
Page xi
Testing the Wrapper Program 420
Testing the Server Timeout 421
Uninstalling the Demonstration Programs 422
Datagram Vulnerability 423
17
Passing Credentials and File Descriptors
427
Problem Statement 428
Introducing Ancillary Data 428
Introducing I/O Vectors 429
The I/O Vector (struct iovec) 429
The readv(2) and writev(2) Functions 430
The sendmsg(2) and recvmsg(2) Functions 432
The sendmsg(2) Function 432
The recvmsg(2) Function 433
Understanding struct msghdr 433
Ancillary Data Structures and Macros 435
Introducing struct cmsghdr Structure 435
Introducing the cmsg(3) Macros 437
Iterating through Ancillary Data 439
Creating Ancillary Data 440
Presenting an Ancillary Data Example 441
The Common Header File common.h 442
The misc.c Module 443
TEAMFLY
Team-Fly®
The recvcred.c Module 443
The Simple Web Server web80 447
The reqport() Function 451
The recv_fd() Function 453
The sockserv Server Program 456
The send_fd() Function 465
Testing the Socket Server 468
Testing sockserv 469
18
A Practical Network Project
473
Problem Statement 474
Solving the Quote Service Problem 474
Obtaining Stock Market Quotes 474
Examining the Quote Server Program 477
Fetching Quotations via get_tickinfo() 484
Page xii
Broadcasting Quotes via broadcast() 493
Examining the Client Program 495
Compiling and Running the Demonstration 500
Starting the qserve Quotation Server 501
Starting the mktwatch Client 501
If the finance.yahoo.com Service Changes 503
Foxit Reader3.0
注:下载后,评价时给5星,还你11分
FoxitReader3.0+PDFEdit+Manual+PDFPasswordRemover3.0破解版.zip
Foxit Reader3.0(绿色版+汉化版+英文版)
注:下载后,评价时给5星,还你11分
一直想找个好用的pdf编辑器,都不满意啊。后在网上看到Foxit Reader3.0好用,就整理了下,得此资源。提供的虽是绿色版,功能可能有限(但对一般玩家够了),但也包含了key,可供升级更新用。
阅读PDF+编辑PDF内容+编辑PDF书签
Learning the vi and Vim Editors, Seventh Edition
注:下载后,评价给5星,还你11分
Part I. Basic and Advanced vi
1. The vi Text Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
A Brief Historical Perspective 5
Opening and Closing Files 6
Quitting Without Saving Edits 10
2. Simple Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
vi Commands 13
Moving the Cursor 14
Simple Edits 18
More Ways to Insert Text 30
Joining Two Lines with J 31
Review of Basic vi Commands 32
3. Moving Around in a Hurry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Movement by Screens 35
Movement by Text Blocks 38
Movement by Searches 39
Movement by Line Number 43
Review of vi Motion Commands 44
4. Beyond the Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
More Command Combinations 47
Options When Starting vi 48
Making Use of Buffers 51
Marking Your Place 52
Other Advanced Edits 53
Review of vi Buffer and Marking Commands 53
vii
5. Introducing the ex Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
ex Commands 55
Editing with ex 58
Saving and Exiting Files 63
Copying a File into Another File 65
Editing Multiple Files 65
6. Global Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Confirming Substitutions 72
Context-Sensitive Replacement 73
Pattern-Matching Rules 74
Pattern-Matching Examples 81
A Final Look at Pattern Matching 89
7. Advanced Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Customizing vi 95
Executing Unix Commands 99
Saving Commands 103
Using ex Scripts 114
Editing Program Source Code 120
8. Introduction to the vi Clones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
And These Are My Brothers, Darrell, Darrell, and Darrell 125
Multiwindow Editing 126
GUI Interfaces 127
Extended Regular Expressions 128
Enhanced Tags 129
Improved Facilities 134
Programming Assistance 138
Editor Comparison Summary 140
Nothing Like the Original 141
A Look Ahead 141
Part II. Vim
9. Vim (vi Improved): An Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Overview 146
Where to Get Vim 150
Getting Vim for Unix and GNU/Linux 151
Getting Vim for Windows Environments 156
Getting Vim for the Macintosh Environment 157
Other Operating Systems 157
viii | Table of Contents
Aids and Easy Modes for New Users 157
Summary 158
10. Major Vim Improvements over vi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Built-in Help 159
Startup and Initialization Options 160
New Motion Commands 167
Extended Regular Expressions 169
Customizing the Executable 171
11. Multiple Windows in Vim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Initiating Multiwindow Editing 174
Opening Windows 177
Moving Around Windows (Getting Your Cursor from Here to There) 180
Moving Windows Around 181
Resizing Windows 183
Buffers and Their Interaction with Windows 186
Playing Tag with Windows 190
Tabbed Editing 191
Closing and Quitting Windows 192
Summary 193
12. Vim Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
What’s Your Favorite Color (Scheme)? 195
Dynamic File Type Configuration Through Scripting 205
Some Additional Thoughts About Vim Scripting 213
Resources 218
13. Graphical Vim (gvim) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
General Introduction to gvim 220
Customizing Scrollbars, Menus, and Toolbars 225
gvim in Microsoft Windows 236
gvim in the X Window System 237
GUI Options and Command Synopsis 237
14. Vim Enhancements for Programmers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Folding and Outlining (Outline Mode) 240
Auto and Smart Indenting 251
Keyword and Dictionary Word Completion 259
Tag Stacking 268
Syntax Highlighting 270
Compiling and Checking Errors with Vim 279
Some Final Thoughts on Vim for Writing Programs 284
Table of Contents | ix
15. Other Cool Stuff in Vim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Editing Binary Files 285
Digraphs: Non-ASCII Characters 287
Editing Files in Other Places 289
Navigating and Changing Directories 290
Backups with Vim 292
HTML Your Text 293
What’s the Difference? 294
Undoing Undos 296
Now, Where Was I? 297
What’s My Line (Size)? 300
Abbreviations of Vim Commands and Options 302
A Few Quickies (Not Necessarily Vim-Specific) 303
More Resources 304
Part III. Other vi Clones
16. nvi: New vi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Author and History 307
Important Command-Line Arguments 308
Online Help and Other Documentation 309
Initialization 309
Multiwindow Editing 310
GUI Interfaces 311
Extended Regular Expressions 311
Improvements for Editing 312
Programming Assistance 315
Interesting Features 315
Sources and Supported Operating Systems 315
17. Elvis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Author and History 317
Important Command-Line Arguments 317
Online Help and Other Documentation 319
Initialization 319
Multiwindow Editing 320
GUI Interfaces 323
Extended Regular Expressions 328
Improved Editing Facilities 328
Programming Assistance 332
Interesting Features 335
elvis Futures 340
x | Table of Contents
Sources and Supported Operating Systems 340
18. vile: vi Like Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Authors and History 343
Important Command-Line Arguments 344
Online Help and Other Documentation 345
Initialization 346
Multiwindow Editing 347
GUI Interfaces 349
Extended Regular Expressions 357
Improved Editing Facilities 359
Programming Assistance 365
Interesting Features 368
Sources and Supported Operating Systems 374
unix环境高级编程(第二版英文版CHM)附源代码.rar
注:下载后,评价给5星,还你11分
Chapter 1. UNIX System Overview
Chapter 2. UNIX Standardization and Implementations
Chapter 3. File I/O
Chapter 4. Files and Directories
Chapter 5. Standard I/O Library
Chapter 6. System Data Files and Information
Chapter 7. Process Environment
Chapter 8. Process Control
Chapter 9. Process Relationships
Chapter 10. Signals
Chapter 11. Threads
Chapter 12. Thread Control
Chapter 13. Daemon Processes
Chapter 14. Advanced I/O
Chapter 15. Interprocess Communication
Chapter 16. Network IPC: Sockets
Chapter 17. Advanced IPC
Chapter 18. Terminal I/O
Chapter 19. Pseudo Terminals
Chapter 20. A Database Library
Chapter 21. Communicating with a Network Printer
Linux程序设计第四版.pdf
注:下载后,评价时给5星,还你11分
Chapter 1: Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Chapter 2: Shell Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Chapter 3: Working with Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Chapter 4: The Linux Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Chapter 5: Terminals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Chapter 6: Managing Text-Based Screens with curses . . . . . . . . . . . . . . . . 211
Chapter 7: Data Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Chapter 8: MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Chapter 9: Development Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Chapter 10: Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
Chapter 11: Processes and Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Chapter 12: POSIX Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
Chapter 13: Inter-Process Communication: Pipes . . . . . . . . . . . . . . . . . . . . 525
Chapter 14: Semaphores, Shared Memory, and Message Queues. . . . . . . . . 577
Chapter 15: Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
Chapter 16: Programming GNOME Using GTK+ . . . . . . . . . . . . . . . . . . . . . . 645
Chapter 17: Programming KDE Using Qt. . . . . . . . . . . . . . . . . . . . . . . . . . . 701
Chapter 18: Standards for Linux. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 761
shell基础十二篇
不用多说学习linux shell的好资料:
shell基础十二篇+Shell十三问。
注:下载后,评价给5星,还你11分
红旗Linux用户基础教程
注:下载后,评价时给5星,还你11分
第1章Linux及红旗Linux简介
第2章红旗Linux中文环境
第3章常用Linux命令介绍
第4章Shell简介
第5章使用vi
第6章使用外部设备
第7章多用户管理及用户安全
第8章备份数据
第9章文件系统
第10章目 录 系 统第
11章文件和目录操作
第12章核心升级和应用软件安装
第13章配置网络和网络服务
linux程序设计(原版)第三版
注:下载后,评价时给5星,还你11分
Chapter 1: Getting Started 1
Chapter 2: Shell Programming 17
Chapter 3: Working with Files 91
Chapter 4: The Linux Environment 135
Chapter 5: Terminals 171
Chapter 6: Managing Text-Based Screens with curses 205
Chapter 7: Data Management 249
Chapter 8: MySQL 303
Chapter 11: Processes and Signals 445
Chapter 12: POSIX Threads 477
Chapter 13: Inter-Process Communication: Pipes 505
Chapter 14: Semaphores, Shared Memory, and Message Queues 557
Chapter 15: Sockets 587
Chapter 16: Programming GNOME Using GTK+ 623
Chapter 17: Programming KDE Using Qt 677
Chapter 18: Device Drivers 721
Chapter 19: Standards for Linux 799
The C Programming Language 800
A Brief History Lesson 800
The GNU Compiler Collection 801
xxvii
Contents
gcc Options 801
Compiler Options for Standards Tracking 802
Define Options for Standard Tracking 802
Compiler Options for Warnings 802
Interfaces and the LSB 803
LSB Standard Libraries 804
A Brief History Lesson 804
Using the LSB Standard for Libraries 805
LSB Users and Groups 805
LSB System Initialization 805
The Filesystem Hierarchy Standard 807
/bin 808
/boot 808
/dev 808
/etc 809
/home 809
/lib 809
/mnt 809
/opt 809
/root 809
/sbin 809
/tmp 809
/usr 810
/var 810
Further Reading about Standards 810
Summary 810
五笔中文输入法安装包
注:下载后,评价时给5星,还你11分
五笔输入法安装包 无插件
五笔输入法安装包 无插件
五笔输入法安装包 无插件
五笔输入法安装包
五笔输入法安装包
TC2.0安装包TC2.0
TC2.0安装包。直接安装即可!
不需改目录,适合新手用。
注:下载后,评价给5星,还你11分
pascal教程+常用算法
注:下载后,评价时给5星,还你11分
计算机基础知识
第一章 计算机基础常识
第二章 操作系统简介
第三章 计算机网络
第四章 计算机信息安全基础知识
Pascal 语言
第一章 开始编写pascal语言程序
第二章 Pascal语言基础知识
第三章 顺序结构程序设计
第四章 选择结构程序设计
第五章 循环结构程序设计
第六章 数组与字符串
第七章 函数和过程
第八章 子界与枚举类型
第九章 集合类型
第十章 记录与文件类型
第十一章 指针
第十二章 程序调试
常用算法与策略
第一章 算法的概念
第二章 递归
第三章 回溯
第四章 排序
第五章 查找
第六章 穷举策略
第七章 贪心算法
第八章 分治策略
数据结构
第一章 什么是数据结构
第二章 线性表
第三章 栈
第四章 队
第五章 树
第六章 图
动态规划
第一章 什么叫动态规划
第二章 用动态规划解题
第三章 典型例题与习题
第四章 动态规划的递归函数法
第五章 动态规划分类1
数学知识及相关算法
第一章 有关数论的算法
第二章 高精度计算
第三章 排列与组合
第四章 计算几何
第五章 其它数学知识及算法
图论算法
第一章 最小生成树
第二章 最短路径
第三章 拓扑排序(AOV网)
第四章 关键路径(AOE网)
第五章 网络流
第六章 图匹配
搜索算法与优化
第一章 双向广度优先搜索
第二章 分支定界法
第三章 A*算法