- [Narrator] The C++ standard library
is used to support
a large number of common system level tasks.
This set of library functions is mostly inherited
from the C standard library
as generally compatible with standard C code.
The standard library includes a great number
of functions and macros supporting
a broad scope of functionalities
including file I/O
facilities for creating reading and writing files.
Support for C strings
null terminated a raise of characters.
Error handling functions
for standardized handling of common system errors.
Date and time functions.
Provide support for common date and time structures.
Other utilities including
math, localization, signals
and other system services.
The headers for the C++ standard library
are the same as those
for the C standard library
with a simple difference.
For C++, the headers have no .h
at the end of the file name
and have a lowercase C at the beginning
like this.
This effectively distinguishes the C++ library headers
from the C versions
which are likely also included
with your development environment.
These C++ library functions are in the standard namespace
for compatibility with C code
these functions are also
in the global namespace.
So it's usually fine to admit the
std:: namespace specifier
at the beginning of the function name
but be aware
that there may be some instances
where it is required.
These functions are all well-documented.
If you're on a Mac or any Unix system
you'll find the documentation
for these functions in the standard man pages.
If you're using windows
or another non-Unix development environment.
You may look in the library documentation
that comes with your developer environment
or by simply typing the name of a function
into any major internet search engine.
It's important to note here that
these are standard library functions.
The C++ standard requires that these are supported.
Some systems
including Microsoft visual studio
have their own versions of these functions.
Microsoft's compiler
takes this non-standard approach a step further
by throwing a warning message
if you use the standard functions
instead of their own versions.
In order to make these exercise files work properly
without error on Microsoft compilers
I've added this preprocessor macro during the setup
for the working project.
This tells the Microsoft compiler not to fail
when it sees these standard functions.
If you're using Microsoft Visual Studio
feel free to use their versions of these functions
instead of the standard versions.
The syntax may vary
but the techniques are the same.
The C++ standard library is very large.
Much larger than could be covered in this course.
For our purposes
I will cover those functions
that are most commonly used for general purpose programming.
There are many good references available
that cover most or all of the library.
The standard library is inherited
from the standard library for the C programming language
as C++ includes the full definition of C.
The standard library is also fully included
in the C++ standard.
Even though C++ has additional
object oriented libraries of its own.
They do not duplicate the functionality
of the standard C library.
So you'll need to use these functions
in your C++ code for many common purposes.