std::basic_ifstream (3) - Linux Manuals
std::basic_ifstream: std::basic_ifstream
NAME
std::basic_ifstream - std::basic_ifstream
Synopsis
Defined in header <fstream>
template<
class CharT,
class Traits = std::char_traits<CharT>
> class basic_ifstream : public std::basic_istream<CharT, Traits>
The class template basic_ifstream implements high-level input operations on file based streams. It interfaces a file-based streambuffer (std::basic_filebuf) with the high-level interface of (std::basic_istream).
A typical implementation of std::basic_ifstream holds only one non-derived data member: an instance of std::basic_filebuf<CharT, Traits>.
std-basic ifstream-inheritance.svg
Inheritance diagram
Two specializations for common character types are also defined:
Defined in header <fstream>
Type Definition
ifstream basic_ifstream<char>
wifstream basic_ifstream<wchar_t>
Member types
Member type Definition
char_type CharT
traits_type Traits; the program is ill-formed if Traits::char_type is not CharT.
int_type Traits::int_type
pos_type Traits::pos_type
off_type Traits::off_type
Member functions
constructor (public member function)
destructor destructs the basic_ifstream and the associated buffer, closes the file
[virtual] (implicitly declared)
operator= moves the file stream
(C++11)
swap swaps two file streams
(C++11)
rdbuf (public member function)
File operations
is_open (public member function)
open (public member function)
close (public member function)
Non-member functions
std::swap(std::basic_ifstream) specializes the std::swap algorithm
(C++11)
Inherited from std::basic_istream
Member functions
Formatted input
operator>> (public member function of std::basic_istream<CharT,Traits>)
Unformatted input
get (public member function of std::basic_istream<CharT,Traits>)
peek (public member function of std::basic_istream<CharT,Traits>)
unget (public member function of std::basic_istream<CharT,Traits>)
putback (public member function of std::basic_istream<CharT,Traits>)
getline (public member function of std::basic_istream<CharT,Traits>)
ignore (public member function of std::basic_istream<CharT,Traits>)
read (public member function of std::basic_istream<CharT,Traits>)
readsome (public member function of std::basic_istream<CharT,Traits>)
gcount (public member function of std::basic_istream<CharT,Traits>)
Positioning
tellg (public member function of std::basic_istream<CharT,Traits>)
seekg (public member function of std::basic_istream<CharT,Traits>)
Miscellaneous
sync (public member function of std::basic_istream<CharT,Traits>)
Member classes
sentry (public member class of std::basic_istream<CharT,Traits>)
Inherited from std::basic_ios
Member types
Member type Definition
char_type CharT
traits_type Traits
int_type Traits::int_type
pos_type Traits::pos_type
off_type Traits::off_type
Member functions
State functions
good (public member function of std::basic_ios<CharT,Traits>)
eof (public member function of std::basic_ios<CharT,Traits>)
fail (public member function of std::basic_ios<CharT,Traits>)
bad (public member function of std::basic_ios<CharT,Traits>)
operator! (public member function of std::basic_ios<CharT,Traits>)
operator_void*
operator_bool checks if no error has occurred (synonym of !fail())
(until C++11)
(since C++11)
rdstate (public member function of std::basic_ios<CharT,Traits>)
setstate (public member function of std::basic_ios<CharT,Traits>)
clear (public member function of std::basic_ios<CharT,Traits>)
Formatting
copyfmt (public member function of std::basic_ios<CharT,Traits>)
fill (public member function of std::basic_ios<CharT,Traits>)
Miscellaneous
exceptions (public member function of std::basic_ios<CharT,Traits>)
imbue (public member function of std::basic_ios<CharT,Traits>)
rdbuf (public member function of std::basic_ios<CharT,Traits>)
tie (public member function of std::basic_ios<CharT,Traits>)
narrow (public member function of std::basic_ios<CharT,Traits>)
widen (public member function of std::basic_ios<CharT,Traits>)
Inherited from std::ios_base
Member functions
Formatting
flags (public member function of std::ios_base)
setf (public member function of std::ios_base)
unsetf (public member function of std::ios_base)
precision (public member function of std::ios_base)
width (public member function of std::ios_base)
Locales
imbue (public member function of std::ios_base)
getloc (public member function of std::ios_base)
Internal extensible array
xalloc returns a program-wide unique integer that is safe to use as index to pword() and iword()
[static]
iword (public member function of std::ios_base)
pword (public member function of std::ios_base)
Miscellaneous
register_callback (public member function of std::ios_base)
sync_with_stdio sets whether C++ and C IO libraries are interoperable
[static]
Member classes
failure (public member class of std::ios_base)
Init (public member class of std::ios_base)
Member types and constants
Type Explanation
openmode in open for reading
fmtflags fixed generate floating point types using fixed notation, or hex notation if combined with scientific: see std::fixed