stream-operators

What's the right way to overload the stream operators << >> for my class?

I'm a bit confused about how to overload the stream operators for my class in C++, since it seems they are functions on the stream classes, not on my class. What's the normal way to do this? At the moment, for the "get from" operator, I have a definition istream& operator>>(istream& is, Thing& thing) { // etc... which works. It's n...

problem with QDataStream & QDataStream::operator>> ( char *& s )

QFile msnLogFile(item->data(Qt::UserRole).toString()); QDataStream logDataStream; if(msnLogFile.exists()){ msnLogFile.open(QIODevice::ReadOnly); logDataStream.setDevice(&msnLogFile); QByteArray logBlock; logDataStream >> logBlock; } This code doesnt work. The QByte that results is empty. Same...

calling operator<< in gdb

How do you call operator<<(std::ostream &os, const ClassX &x) from inside gdb ? In other words, how do you print an object in gdb ? call std::cout<<x or call operator<<(std::cout, x) don't seems to work for me! Any ideas? ...