Boost logo

Boost Users :

Subject: [Boost-users] using system:error_code
From: Lloyd (lloyd_at_[hidden])
Date: 2010-07-01 06:32:16


How can I interpret and use the error_code in my application?

As an example my ASIO async_read "handler function" receives one argument as error, as shown below

void MyClass::AsyncReadHandler(const boost::system::error_code& error,std::size_t bytes_transferred)

How can I inrterpret the "error" in a meaningful way? error.message() returns the meaning of the error and and error.value() returns an integer code associated with the error. So far fine, but how can I use it in a comparison operator in a portable way...

if(error.value()==2) //Not readable

if(error.value()==END_OF_FILE) //More readable

So how can I get the respective "enum" associated with the error

Thanks a lot,

Scanned and protected by Email scanner

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at