⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 library_1.html

📁 Glibc的中文手册
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<A NAME="IDX35"></A>
<P>
The exact set of features available when you compile a source file
is controlled by which <DFN>feature test macros</DFN> you define.
<P>
If you compile your programs using <SAMP>`gcc -ansi'</SAMP>, you get only
the ANSI C library features, unless you explicitly request additional
features by defining one or more of the feature macros.
See section 'Options' in <CITE>The GNU CC Manual</CITE>, for more information
about GCC options.<P>
You should define these macros by using <SAMP>`#define'</SAMP> preprocessor
directives at the top of your source code files.  You could also use 
the <SAMP>`-D'</SAMP> option to GCC, but it's better if you make the source
files indicate their own meaning in a self-contained way.
<P>
<A NAME="IDX36"></A>
<U>Macro:</U> <B>_POSIX_SOURCE</B><P>
If you define this macro, then the functionality from the POSIX.1
standard (IEEE Standard 1003.1) is available, as well as all of the
ANSI C facilities.
<P>
<A NAME="IDX37"></A>
<U>Macro:</U> <B>_POSIX_C_SOURCE</B><P>
If you define this macro with a value of <CODE>1</CODE>, then the
functionality from the POSIX.1 standard (IEEE Standard 1003.1) is made
available.  If you define this macro with a value of <CODE>2</CODE>, then both
the functionality from the POSIX.1 standard and the functionality from
the POSIX.2 standard (IEEE Standard 1003.2) are made available.  This is
in addition to the ANSI C facilities.
<P>
<A NAME="IDX38"></A>
<U>Macro:</U> <B>_BSD_SOURCE</B><P>
If you define this macro, functionality derived from 4.3 BSD Unix is
included as well as the ANSI C, POSIX.1, and POSIX.2 material.
<P>
Some of the features derived from 4.3 BSD Unix conflict with the
corresponding features specified by the POSIX.1 standard.  If this
macro is defined, the 4.3 BSD definitions take precedence over the
POSIX definitions.
<P>
<A NAME="IDX39"></A>
<U>Macro:</U> <B>_SVID_SOURCE</B><P>
If you define this macro, functionality derived from SVID is
included as well as the ANSI C, POSIX.1, and POSIX.2 material.
<P>
<A NAME="IDX40"></A>
<U>Macro:</U> <B>_GNU_SOURCE</B><P>
If you define this macro, everything is included: ANSI C, POSIX.1,
POSIX.2, BSD, SVID, and GNU extensions.  In the cases where POSIX.1
conflicts with BSD, the POSIX definitions take precedence.
<P>
If you want to get the full effect of <CODE>_GNU_SOURCE</CODE> but make the
BSD definitions take precedence over the POSIX definitions, use this
sequence of definitions:
<P>
<PRE>
#define _GNU_SOURCE
#define _BSD_SOURCE
#define _SVID_SOURCE
</PRE>
<P>
We recommend you use <CODE>_GNU_SOURCE</CODE> in new programs.
If you don't specify the <SAMP>`-ansi'</SAMP> option to GCC and don't define
any of these macros explicitly, the effect as the same as defining
<CODE>_GNU_SOURCE</CODE>.
<P>
When you define a feature test macro to request a larger class of
features, it is harmless to define in addition a feature test macro for
a subset of those features.  For example, if you define
<CODE>_POSIX_C_SOURCE</CODE>, then defining <CODE>_POSIX_SOURCE</CODE> as well has
no effect.  Likewise, if you define <CODE>_GNU_SOURCE</CODE>, then defining
either <CODE>_POSIX_SOURCE</CODE> or <CODE>_POSIX_C_SOURCE</CODE> or
<CODE>_SVID_SOURCE</CODE> as well has no effect.
<P>
Note, however, that the features of <CODE>_BSD_SOURCE</CODE> are not a subset
of any of the other feature test macros supported.  This is because it
defines BSD features that take precedence over the POSIX features that
are requested by the other macros.  For this reason, defining
<CODE>_BSD_SOURCE</CODE> in addition to the other feature test macros does
have an effect: it causes the BSD features to take priority over the
conflicting POSIX features.
<P>
<H2><A NAME="SEC13" HREF="library_toc.html#SEC13" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC13">Roadmap to the Manual</A></H2>
<P>
Here is an overview of the contents of the remaining chapters of
this manual.
<P>
<UL>
<LI>
section <A HREF="library_2.html#SEC14" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_2.html#SEC14">Error Reporting</A>, describes how errors detected by the library
are reported.
<P>
<LI>
section <A HREF="library_28.html#SEC470" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_28.html#SEC470">C Language Facilities Implemented By the Library</A>, contains information about library support for
standard parts of the C language, including things like the
<CODE>sizeof</CODE> operator and the symbolic constant <CODE>NULL</CODE>, and how to
write functions accepting variable numbers of arguments.
<P>
<LI>
section <A HREF="library_3.html#SEC18" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_3.html#SEC18">Memory Allocation</A>, describes the GNU library's facilities for
dynamic allocation of storage.  If you do not know in advance how much
storage your program needs, you can allocate it dynamically instead,
and manipulate it via pointers.
<P>
<LI>
section <A HREF="library_4.html#SEC54" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_4.html#SEC54">Character Handling</A>, contains information about character
classification functions (such as <CODE>isspace</CODE>) and functions for
performing case conversion.
<P>
<LI>
section <A HREF="library_5.html#SEC57" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_5.html#SEC57">String and Array Utilities</A>, has descriptions of functions for
manipulating strings (null-terminated character arrays) and general
byte arrays, including operations such as copying and comparison.
<P>
<LI>
section <A HREF="library_6.html#SEC66" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_6.html#SEC66">Extended Characters</A>, contains information about manipulating
characters and strings using character sets larger than will fit in
the usual <CODE>char</CODE> data type.  
<P>
<LI>
section <A HREF="library_7.html#SEC76" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_7.html#SEC76">Locales and Internationalization</A>, describes how selecting a particular country 
or language affects the behavior of the library.  For example, the locale
affects collation sequences for strings and how monetary values are
formatted.
<P>
<LI>
section <A HREF="library_8.html#SEC86" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_8.html#SEC86">Searching and Sorting</A>, contains information about functions
for searching and sorting arrays.  You can use these functions on any
kind of array by providing an appropriate comparison function.
<P>
<LI>
section <A HREF="library_10.html#SEC108" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_10.html#SEC108">Input/Output Overview</A>, gives an overall look at the input and output
facilities in the library, and contains information about basic concepts
such as file names.
<P>
<LI>
section <A HREF="library_11.html#SEC117" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_11.html#SEC117">Input/Output on Streams</A>, describes I/O operations involving streams (or
<CODE>FILE *</CODE> objects).  These are the normal C library functions
from <TT>`stdio.h'</TT>.
<P>
<LI>
section <A HREF="library_12.html#SEC171" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC171">Low-Level Input/Output</A>, contains information about I/O operations
on file descriptors.  File descriptors are a lower-level mechanism
specific to the Unix family of operating systems.
<P>
<LI>
section <A HREF="library_13.html#SEC187" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_13.html#SEC187">File System Interface</A>, has descriptions of operations on entire
files, such as functions for deleting and renaming them and for creating
new directories.  This chapter also contains information about how you
can access the attributes of a file, such as its owner and file protection
modes.
<P>
<LI>
section <A HREF="library_14.html#SEC211" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_14.html#SEC211">Pipes and FIFOs</A>, contains information about simple interprocess
communication mechanisms.  Pipes allow communication between two related
processes (such as between a parent and child), while FIFOs allow
communication between processes sharing a common file system.
<P>
<LI>
section <A HREF="library_15.html#SEC216" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_15.html#SEC216">Sockets</A>, describes a more complicated interprocess communication
mechanism that allows processes running on different machines to
communicate over a network.  This chapter also contains information about
Internet host addressing and how to use the system network databases,
such as <TT>`/etc/hosts'</TT>.
<P>
<LI>
section <A HREF="library_16.html#SEC268" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_16.html#SEC268">Low-Level Terminal Interface</A>, describes how you can change the
attributes of a terminal device.  If you want to disable echo of
characters typed by the user, for example, read this chapter.
<P>
<LI>
section <A HREF="library_28.html#SEC471" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_28.html#SEC471">Explicitly Checking Internal Consistency</A>, contains information about a simple
debugging mechanism.  You can put assertions in your code, and
diagnostic messages are printed if the test fails.
<P>
<LI>
section <A HREF="library_17.html#SEC290" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_17.html#SEC290">Mathematics</A>, contains information about the math library
functions.  These include things like random-number generators and
remainder functions on integers as well as the usual trigonometric and
exponential functions on floating-point numbers.
<P>
<LI>
section <A HREF="library_19.html#SEC309" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_19.html#SEC309">Date and Time</A>, describes functions for measuring both calendar time
and CPU time, as well as functions for setting alarms and timers.
<P>
<LI>
section <A HREF="library_20.html#SEC326" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_20.html#SEC326">Non-Local Exits</A>, contains descriptions of the <CODE>setjmp</CODE> and
<CODE>longjmp</CODE> functions.
<P>
<LI>
section <A HREF="library_21.html#SEC330" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html#SEC330">Signal Handling</A>, tells you all about signals--what they are,
how to establish a handler that is called when a particular kind of
signal is delivered, and how to prevent signals from arriving during
critical sections of your program.
<P>
<LI>
section <A HREF="library_23.html#SEC401" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_23.html#SEC401">Child Processes</A>, contains information about how to start new processes
and run programs.
<P>
<LI>
section <A HREF="library_22.html#SEC385" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_22.html#SEC385">Process Startup and Termination</A>, tells how your programs can access their
command-line arguments and environment variables.
<P>
<LI>
section <A HREF="library_24.html#SEC411" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_24.html#SEC411">Job Control</A>, describes functions for manipulating process groups.
This material is probably only of interest if you are writing a shell.
<P>
<LI>
section <A HREF="library_25.html#SEC441" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_25.html#SEC441">User Database</A>, and section <A HREF="library_25.html#SEC446" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_25.html#SEC446">Group Database</A>, tell you how to access
the system user and group databases.
<P>
<LI>
section <A HREF="library_26.html#SEC451" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_26.html#SEC451">System Information</A>, describes functions for getting information
about the hardware and software configuration your program is executing
under.
<P>
<LI>
section <A HREF="library_28.html#SEC486" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_28.html#SEC486">Range of an Integer Type</A>, contains information about
parameters that characterize the sizes of integer and floating-point
types used by the particular C implementation that your program has
been compiled with.  Most of these parameters are provided for 
compatibility with ANSI C.
<P>
<LI>
section <A HREF="library_27.html#SEC454" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_27.html#SEC454">System Configuration Parameters</A>, tells you how you can get
information about various operating system limits.  Most of these
parameters are provided for compatibility with POSIX.
</UL>
<P>
If you already know the name of the facility you are interested in, you
can look it up in section <A HREF="library_29.html#SEC492" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_29.html#SEC492">Summary of Library Facilities</A>.  This gives you a summary of
its syntax and a pointer to where you can find a more detailed
description.  This appendix is particularly useful if you just want to
verify the order and type of arguments to a function, for example.
<P>Go to the <A HREF="library_2.html" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_2.html">next</A> section.<P>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -