Questions tagged [istream]

In C++ std::istream is the base class for input streams.

658 questions
-1
votes
2 answers

Problems regarding Overloading the input operator >> for reading text file

I have a Point2D class and i am trying to overload the input operator >> class Point2D { public: Point2D(int,int); int getX(); int getY(); void setX(int); void setY(int); double…
Computernerd
  • 6,278
  • 16
  • 58
  • 90
-1
votes
2 answers

Getting invalid initialization of reference of type 'std::istream&' from expression of type 'int'

I am trying to create a class that works with rational numbers and performing operator overloading on them. I am having issue on one part of the program, the input stream. I am supposed to take input in the format "12/8" for example, and it should…
Goose
  • 1,530
  • 8
  • 28
  • 40
-2
votes
1 answer

Parsing text with str method of istringstream

I want to parse the following text from a file example_file.txt # Number of busStop 3 # Id Name Lat Lon 1 Cadorna 450781 76761 using the following example code: int main() { int _numberBus; ifstream file; …
J.C.VegaO
  • 341
  • 1
  • 6
-2
votes
1 answer

Not sure whats going wrong (string input)

writing a program for a class where we use functions to copy a list of data from an input txt file. One of my functions is to get the input for what file name they would like to search the data for. Heres my pre processor directions for my file as…
-2
votes
1 answer

c++ reading a file multiple threads

I have a big file, more than 89 million lines. I want to read a file pash it to a hash table and then make some calculations. The problem is that with istream the reading of the file and passing it to the hash table is too slow. Is there any…
-2
votes
1 answer

in terms of design: overloading the insertion operator for a class member of type vector

Attempting to read from a source file to store person objects into a container. A person object is initialized with a random age, id and a categories vector of five assorted chars. person.hpp class person { protected : int age; // 0 - 99 …
andres
  • 259
  • 2
  • 16
-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
  • 14,848
  • 25
  • 101
  • 181
-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…
-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…
-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
  • 293
  • 2
  • 6
  • 22
-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
1 2 3
43
44