Пример #1
0
bool istream::readn_peek(string& buf, size_t cnt, bool clear /* = false */)
{
	if (clear)
		buf.clear();

	int ready;
	if (acl_vstream_readn_peek(stream_, buf.vstring(),
		(int) cnt, &ready) == ACL_VSTREAM_EOF)
	{
		eof_ = true;
	}
	return ready ? true : false;
}
Пример #2
0
bool istream::readn_peek(string& buf, size_t cnt, bool clear /* = false */)
{
	if (clear)
		buf.clear();

	int ready;
	if (acl_vstream_readn_peek(stream_, buf.vstring(),
		(int) cnt, &ready) == ACL_VSTREAM_EOF)
	{
#if ACL_EWOULDBLOCK == ACL_EAGAIN
		if (stream_->errnum != ACL_EWOULDBLOCK)
#else
		if (stream_->errnum != ACL_EWOULDBLOCK
			&& stream_->errnum != ACL_EAGAIN)
#endif
		{
			eof_ = true;
		}
	}
	return ready ? true : false;
}