">>" whats the meaning of this?

Whats the meaning of this "<<"? I've tried googling but the search won't retrieve the result
closed account (z05DSL3A)
In what context? Technically << is a left shift operator and >> is a right shift operator.
like with cout or when you are reading or writing data.

For example

1
2
3
4
5
while (messy_file >> next)
    {
        cout << setw(field_width) << next << endl;
        neat_file << setw(field_width) << next << endl;
    }
closed account (z05DSL3A)
In this case they are used for insertion and extraction with the I/O streams.

<< insert into the stream: http://www.cplusplus.com/reference/iostream/ostream/operator%3C%3C/

>> extract from the stream: http://www.cplusplus.com/reference/iostream/istream/operator%3E%3E/

The links to the reference pages here seem to be broken at this point.
Last edited on

In C++, you can overload an operator. For example: you can not do A + B (if A & B are of class type), but you can overload operator + to sum them.

Similarly, >>, and << operator are overloaded by stream, and they used for stream get and put.


Gorav
http://www.kgsepg.com
Topic archived. No new replies allowed.