Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/filesystem/doc/fstream.htm @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

File size: 4.1 KB
Line 
1<html>
2
3<head>
4<meta http-equiv="Content-Language" content="en-us">
5<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
6<meta name="ProgId" content="FrontPage.Editor.Document">
7<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
8<title>Boost Filesystem fstream Header</title>
9</head>
10
11<body bgcolor="#FFFFFF">
12
13<h1>
14<img border="0" src="../../../boost.png" align="center" width="277" height="86"><a href="../../../boost/filesystem/fstream.hpp">boost/filesystem/fstream.hpp</a></h1>
15
16<h2><a name="Introduction">Introduction</a></h2>
17
18<p>The C++ Standard Library's <i>&lt;fstream&gt;</i> header uses <i>const char*</i> to
19pass arguments representing file names, with that usage occurring seven
20times.</p>
21
22<p>The Filesystem Library's <i>fstream.hpp</i> header provides equivalent
23components, in namespace <i>
24boost::filesystem</i>, except that the seven&nbsp; <i>
25const char*</i> arguments have been replaced by <i>const path&amp;</i> arguments.</p>
26
27<p>The Filesystem Library's <i>fstream.hpp</i> header simply uses the <i>&lt;fstream&gt;</i> 
28standard library components as base classes, and then redeclares constructors
29and open functions to take arguments of type <i>const path&amp;</i> instead of <i>
30const char*</i>.</p>
31
32<p>For documentation beyond the synopsis, see the
33<a href="index.htm#tutorial">tutorial</a> and <a href="index.htm#Examples">
34examples</a>.</p>
35
36<h2><a name="Synopsis">Synopsis</a></h2>
37<pre>namespace boost
38{
39  namespace filesystem
40  {
41    template &lt; class charT, class traits = std::char_traits&lt;charT&gt; &gt;
42    class basic_filebuf : public std::basic_filebuf&lt;charT,traits&gt;
43    {
44    public:
45      virtual ~basic_filebuf() {}
46
47      std::basic_filebuf&lt;charT,traits&gt; * open( const path &amp; file_ph,
48        std::ios_base::openmode mode );
49    };
50
51    typedef basic_filebuf&lt;char&gt; filebuf;
52    typedef basic_filebuf&lt;wchar_t&gt; wfilebuf;
53
54    template &lt; class charT, class traits = std::char_traits&lt;charT&gt; &gt;
55    class basic_ifstream : public std::basic_ifstream&lt;charT,traits&gt;
56    {
57    public:
58      basic_ifstream() {}
59      explicit basic_ifstream( const path &amp; file_ph,
60        std::ios_base::openmode mode = std::ios_base::in );
61      virtual ~basic_ifstream() {}
62      void open( const path &amp; file_ph,
63        std::ios_base::openmode mode = std::ios_base::in );
64    };
65
66    typedef basic_ifstream&lt;char&gt; ifstream;
67    typedef basic_ifstream&lt;wchar_t&gt; wifstream;
68
69    template &lt; class charT, class traits = std::char_traits&lt;charT&gt; &gt;
70    class basic_ofstream : public std::basic_ofstream&lt;charT,traits&gt;
71    {
72    public:
73      basic_ofstream() {}
74      explicit basic_ofstream( const path &amp; file_ph,
75        std::ios_base::openmode mode = std::ios_base::out );
76      virtual ~basic_ofstream() {}
77      void open( const path &amp; file_ph,
78        std::ios_base::openmode mode = std::ios_base::out );
79    };
80
81    typedef basic_ofstream&lt;char&gt; ofstream;
82    typedef basic_ofstream&lt;wchar_t&gt; wofstream;
83
84    template &lt; class charT, class traits = std::char_traits&lt;charT&gt; &gt;
85    class basic_fstream : public std::basic_fstream&lt;charT,traits&gt;
86    {
87    public:
88      basic_fstream() {}
89      explicit basic_fstream( const path &amp; file_ph,
90        std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out );
91      virtual ~basic_fstream() {}
92      void open( const path &amp; file_ph,
93        std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out );
94    };
95 
96    typedef basic_fstream&lt;char&gt; fstream;
97    typedef basic_fstream&lt;wchar_t&gt; wfstream;
98  } // namespace filesystem
99} // namespace boost
100</pre>
101<hr>
102<p>Revised
103<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->12 March, 2004<!--webbot bot="Timestamp" endspan i-checksum="28865" --></p>
104
105<p>© Copyright Beman Dawes, 2002</p>
106<p> Use, modification, and distribution are subject to the Boost Software
107License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
108LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
109www.boost.org/LICENSE_1_0.txt</a>)</p>
110
111</body>
112
113</html>
Note: See TracBrowser for help on using the repository browser.