0

I'm trying to read from a .dat file using the following code:

ifstream input_file; 
double x;
while (input_file >> x) {...}

I don't understand how this actually works though - input_file >> x seems like it's using the right bit-shift operator. In what way does that actually read the file?

Dan Oberlam
  • 2,435
  • 9
  • 36
  • 54
  • Where did you get this code? – Klaus Aug 04 '15 at 14:42
  • I assume this is C++? – Dan Oberlam Aug 04 '15 at 14:49
  • 1
    possible duplicate of [Operator overloading](http://stackoverflow.com/questions/4421706/operator-overloading) – Dan Oberlam Aug 04 '15 at 14:51
  • The actual meaning of an operator isn't fixed in C++, but depends on its context. Classes can change the meaning of an operator using operator overloading. For an example of this taken to an extreme see [Boost Spirit](http://www.boost.org/doc/libs/1_58_0/libs/spirit/doc/html/index.html) – Mark Ransom Aug 04 '15 at 16:00

0 Answers0