File: intro.yo

package info (click to toggle)
c%2B%2B-annotations 12.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,044 kB
  • sloc: cpp: 24,337; makefile: 1,517; ansic: 165; sh: 121; perl: 90
file content (31 lines) | stat: -rw-r--r-- 1,809 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Computers commonly store information that must survive reboots in their file
systems. Traditionally, to manipulate the file system the bf(C) programming
language offers functions performing the required system calls.  Such
functions (like bf(rename)(2), tt(truncate)(2), bf(opendir)(2), and
bf(realpath)(3)) are of course also available in bf(C++), but their signatures
and way of use are often less attractive as they usually expect tt(char const
*) parameters and may use static buffers or memory allocation based on
bf(malloc)(3) and bf(free)(3).

Since 2003 the hi(Boost Filesystem)url(Boost library)
(http://www.boost.org/doc/libs/1_65_1/libs/filesystem/doc/index.htm)
    offers em(wrappers) around these functions,
offering interfaces to those system calls that are more bf(C++)-like.
    
Currently bf(C++) directly supports these functions in the
tt(std::filesystem)hi(filesystem) namespace. These facilities can be used
after including the tthi(filesystem) header file.

The tt(filesystem) namespace is extensive: it contains more than 10 different
classes, and more than 30 free functions. To refer to the identifiers defined
in the tt(std::filesystem) namespace their fully qualified names (e.g.,
tt(std::filesystem::path) can be used). Alternatively, after specifying
`tt(using namespace std::filesystem;)' the identifiers can be used without
further qualifications. Namespace specifications like `tt(namespace fs =
std::filesystem;)' are also encountered, allowing specifications like
tt(fs::path).

Functions in the tt(filesystem) namespace may fail. When functions cannot
perform their assigned tasks they may throw exceptions (cf. chapter
ref(EXCEPTIONS)) or they may assign values to tt(error_code) objects that
are passed as arguments to those functions (see section ref(ERRORCODE) below).