Пример #1
0
		CharArray NativeStream::read(size_t length)
		{
			CharArray buf;
			buf.buffer(length);

			ssize_t result = ::read(fd, buf.str_ref(), buf.size());

			if(result < 0)
				raise("Unable to read from file descriptor");

			buf.shrink((size_t)result);
			return buf;
		}
Пример #2
0
		void NativeStream::print(const CharArray &string)
		{
			if(write(fd, string.str_ref(), string.size()) == -1)
				raise("Unable to write to file descriptor");
		}