In C++ std::istream is the base class for input streams.
Questions tagged [istream]
696 questions
-2
votes
2 answers
Why does std::istream::ignore discard characters?
On the CPlusPlus website for std::istream::ignore, it says
istream& ignore (streamsize n = 1, int delim = EOF);
Extract and discard characters
Extracts characters from the input
sequence and discards them, until either n characters have been
…

puk
- 16,318
- 29
- 119
- 199
-2
votes
1 answer
What does the istream extraction operator >> return?
I'm trying to get Solipsis to compile in Visual Studio 2017(it was written for VS 2005)
I can't figure out what this code is trying to do:
template
bool from_string( const char* Str, T & Dest )
{
// créer un flux à partir de la…

Hsingai Altaica
- 13
- 4
-2
votes
1 answer
Error when assigning the return of (cin >> someVar) to an istream variable in C++
I just started learning C++ as an additional language and came across the problem mentioned in the title. Here's the code I started out with:
#include "HelloWorldWriter.h"
#include
using namespace std;
int…

sildave94
- 11
- 2
-2
votes
1 answer
Overloading Insertion and Extraction Operators as Templates
I am trying to overload ostream and istream as a freind of the class in a template. I have looked online but have not been able to find much that specifies about template overloading, also what I have seen seems to state that this is the prpoer way…

G.Erezuma
- 1
- 1
-2
votes
1 answer
Reading cin from a file not working
I'm working on a project where I have to read a dictionary from a text file using command line redirection (ie. ./myprog myargs < in.txt)
I then pass cin to a function to construct a dictionary object.
int main(int argc, char *argv[]) {
Dictionary…

Nate Neal
- 1
- 2
-2
votes
1 answer
Basic Explanation of little bit of C++
Can some lovely soul help me out with this one :)
Could you please explain each piece of this line of code
and what each Individual piece does? Thank you in advance.
istream & operator >>( istream & input, Registration & R )
ostream & operator…

Eli Carter
- 11
- 1
-2
votes
2 answers
why there are two member functions?
I am learning c++, however, I can not understand what is the difference BTW:
std::cin.get();
and
std::cin.getline();
although;I know how to use each of them, but can't understand why there are two?
I've read this explanation :
getlinereads the…

pastram
- 3
- 1
-2
votes
2 answers
compilation error with iostream usage for console program
I wanted to make an C++ programm to learn more about terminal input an variables, but I get this error message every time I try to compile it:
var.cpp: In Funktion »int main()«:
var.cpp:16:8: Fehler: Anweisung kann die Adresse der überladenen…

Gilgamesch
- 313
- 2
- 10
- 24
-2
votes
1 answer
splitting a string not working properly c++
I just wanted to split the inputted string to an vector of strings. I have 2 problems:
If I enter nothing into the console , params isn't empty (but it should be)
If I enter a word and add a space at the end , the word gets stored into params…

Rafa
- 101
- 1
- 2
-2
votes
1 answer
How to open file based on user input?
This code keeps giving me errors i dont know what Im doing wrong?
How can I request the user to input the filename and then open that file and perform
tasks with the data.
Example:
#include
#include
#include
using…

user1725435
- 11
- 1
- 2
- 6
-2
votes
3 answers
C++ istream,read query , initial argument
The read function has it's first argument as pointer to an array to store the n bytes(mentioned by the second argument) in the file...
The query is,
if i have created 2 objects of class x..
then,
x stack[2];
Assume i've filled the 2 object…

bkcpro
- 15
- 7
-3
votes
2 answers
Constructor with ostream and istream parameters
I've got a question implementing a class constructor that has istream and ostream parameters. These values are to be used within the scope of the class. I am building a game that will ask questions and I want to use the istream parameter to collect…

Drakn
- 3
- 2
-3
votes
1 answer
Issues converting istream to ifstream while passing std::cin into an argument
I am currently implementing a text-file based testing UI that will take mocked up user inputs from a text file (line-by-line) to simulate real user input instead of using std::cin.
The issue arises when I attempt to pass std::cin into std::ifstream…

Jared F.
- 1
- 1
-3
votes
2 answers
Unknown cin properties
Try as I might, I cannot find any information on what cin.binary is for.
similar ones, thinking bases, dec, hex, octal only seem to appear when used with cout - e.g.,
cout << std::hex << n;.
However cout << std::binary << n; isn't valid
Entering…

peedurrr
- 187
- 16
-3
votes
1 answer
ifstream-istream and function call
I am new to c++ and while i was working with streams i saw the following code:
#include
#include
#include
#include
#include
using namespace std;
class Results
{
public:
string const&…

nikos_k
- 49
- 1
- 4