Top "Iostream" questions

The C++ iostream library is an object-oriented library that provides input and output functionality using streams.

Unexpected results with std::ofstream binary write

I'm new to C++ std::stream and I'm making some tests. I have this simple code: int i = 10; char c = …

c++ iostream
Do I have to use #include <string> beside <iostream>?

I started learning C++ and I read a book which writes that I must use the <string> header …

c++ string types include iostream
Standard no-op output stream

Is there a way to create an ostream instance which basically doesn't do anything ? For example : std::ostream dummyStream(...); dummyStream &…

c++ iostream
checking data availability before calling std::getline

I would like to read some data from a stream I have using std::getline. Below a sample using the …

c++ iostream
Why use showpoint when you can use setprecision fixed?

I don't quite understand the purpose of showpoint, i know it forces to show a decimal point, but having "cout &…

c++ iostream iomanip
c++ console screen size

So I'm learning some stuff in College on C++, and the teacher and I got into a discussion on how …

c++ windows console iostream setw
how can I read exactly 128 bytes from an fstream into a string object?

How do I read exactly 128 bytes from an fstream into a string object? I wrote some code to read the …

c++ string iostream fstream ifstream
C++ Streams vs. C-style IO?

I was coding some C++ for a small hobby project when I noticed that I'm using C-style operations to access …

c++ io printf iostream
Redirecting standard input of console application

I have a console application which I'm trying to automate by redirecting Standard input stream of the process. In manual …

c# process iostream io-redirection
Are there any tricks to use std::cin to initialize a const variable?

Common std::cin usage int X; cin >> X; The main disadvantage of this is that X cannot be …

c++ c++11 iostream