C++ (Qt)struct MyDataStream : public QDataStream { MyDataStream( QDataStream & strm ) : mStrm(strm) {} template <class T> MyDataStream & operator >> ( T & dst ) { mStrm >> dst; if (mStrm.status() != Ok) throw "Error"; return *this; } QDataStream & mStrm;};