Top "Ifstream" questions

ifstream provides an interface to read data from files as input streams.

How to initialize std::unique_ptr in constructor?

A.hpp: class A { private: std::unique_ptr<std::ifstream> file; public: A(std::string filename); }; A.cpp: …

c++ smart-pointers ifstream unique-ptr
tellg() function give wrong size of file?

I did a sample project to read a file into a buffer. When I use the tellg() function it gives …

c++ file ifstream
Read text file into char Array. C++ ifstream

Im trying to read the whole file.txt into a char array. But having some issues, suggestions please =] ifstream infile; …

c++ arrays char ifstream
Why am I getting this ifstream error?

Implicit instantiation of undefined template 'std::basic_ifstream<char,std::char_traits<char>>' #ifndef MAPPER_…

c++ compiler-errors fstream ifstream
How to read huge file in c++

If I have a huge file (eg. 1TB, or any size that does not fit into RAM. The file is …

c++ file ifstream
C++ - Read file until reaching end of line with >> operators

I have looked around a lot, and still not found how to do this, so, please bear with me. Let's …

c++ operators ifstream peek end-of-line
istream::getline return type

What does the istream::getline method return? I am asking because I have seen that to loop through a file, …

c++ file-io ifstream getline istream
How can I manually read PNG files in C++?

Portable Network Graphics Overview The general layout of any given PNG file looks like this: File Header: An 8-byte signature. …

c++ file-io png fstream ifstream
How to read formatted data in C++?

I have formatted data like the following: Words 5 AnotherWord 4 SomeWord 6 It's in a text file and I'm using ifstream to …

c++ string iostream ifstream string-parsing
How can I use non-default delimiters when reading a text file with std::fstream?

In my C++ code, I want to read from a text file (*.txt) and tokenize every entry. More specifically, I …

c++ fstream ifstream