Exemple #1
0
bool istream::gets_peek(string& buf, bool nonl /* = true */,
	bool clear /* = false */, int max /* = 0 */)
{
	if (clear)
		buf.clear();

	if (max > 0)
		buf.set_max(max);

	int ready, ret;
	ACL_VSTRING *vbf = (ACL_VSTRING*) buf.vstring();
	if (nonl)
		ret = acl_vstream_gets_nonl_peek(stream_, vbf, &ready);
	else
		ret = acl_vstream_gets_peek(stream_, vbf, &ready);
	if (ret == 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;
}
Exemple #2
0
bool istream::gets_peek(string& buf, bool nonl /* = true */,
	bool clear /* = false */)
{
	if (clear)
		buf.clear();

	int ready, ret;
	ACL_VSTRING *vbf = (ACL_VSTRING*) buf.vstring();
	if (nonl)
		ret = acl_vstream_gets_nonl_peek(stream_, vbf, &ready);
	else
		ret = acl_vstream_gets_peek(stream_, vbf, &ready);
	if (ret == ACL_VSTREAM_EOF)
		eof_ = true;
	return ready ? true : false;
}