The GNU C Library Reference Manual
The GNU C Library
Reference Manual
Sandra Loosemore
with
Richard M. Stallman, Roland McGrath, Andrew Oram, and Ulrich Drepper
Edition 0.09 DRAFT
last updated 28 Aug 1999
for version 2.2 Beta
Copyright
c
1993, ’94, ’95, ’96, ’97, ’98 Free Software Foundation, Inc.
Published by the Free Software Foundation
59 Temple Place – Suite 330,
Boston, MA 02111-1307 USA
Printed copies are available for $50 each.
ISBN 1-882114-53-1
Permission is granted to make and distribute verbatim copies of this manual provided the
copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the
conditions for verbatim copying, provided also that the section entitled “GNU Library
General Public License” is included exactly as in the original, and provided that the entire
resulting derived work is distributed under the terms of a permission notice identical to this
one.
Permission is granted to copy and distribute translations of this manual into another lan-
guage, under the above conditions for modified versions, except that the text of the trans-
lation of the section entitled “GNU Library General Public License” must be approved for
accuracy by the Foundation.
Chapter 1: Introduction 1
1 Introduction
The C language provides no built-in facilities for performing such common operations
as input/output, memory management, string manipulation, and the like. Instead, these
facilities are defined in a standard library, which you compile and link with your programs.
The GNU C library, described in this document, defines all of the library functions that
are specified by the ISO C standard, as well as additional features specific to POSIX and
other derivatives of the Unix operating system, and extensions specific to the GNU system.
The purpose of this manual is to tell you how to use the facilities of the GNU library.
We have mentioned which features belong to which standards to help you identify things
that are potentially non-portable to other systems. But the emphasis in this manual is not
on strict portability.
1.1 Getting Started
This manual is written with the assumption that you are at least somewhat familiar with
the C programming language and basic programming concepts. Specifically, familiarity with
ISO standard C (see Section 1.2.1 [ISO C], page 2), rather than “traditional” pre-ISO C
dialects, is assumed.
The GNU C library includes several header files, each of which provides definitions and
declarations for a group of related facilities; this information is used by the C compiler
when processing your program. For example, the header file ‘stdio.h’ declares facilities
for performing input and output, and the header file ‘string.h’ declares string processing
utilities. The organization of this manual generally follows the same division as the header
files.
If you are reading this manual for the first time, you should read all of the introductory
material and skim the remaining chapters. There are a lot of functions in the GNU C
library and it’s not realistic to expect that you will be able to remember exactly how to
use each and every one of them. It’s more important to become generally familiar with the
kinds of facilities that the library provides, so that when you are writing your programs you
can recognize when to make use of library functions, and where in this manual you can find
more specific information about them.
1.2 Standards and Portability
This section discusses the various standards and other sources that the GNU C library
is based upon. These sources include the ISO C and POSIX standards, and the System V
and Berkeley Unix implementations.
The primary focus of this manual is to tell you how to make effective use of the GNU
library facilities. But if you are concerned about making your programs compatible with
these standards, or portable to operating systems other than GNU, this can affect how you
use the library. This section gives you an overview of these standards, so that you will know
what they are when they are mentioned in other parts of the manual.