8 Console::Console(Stream s):
11 mode = (stream==CIN ? M_READ : M_WRITE);
19 void Console::set_block(bool b)
21 sys_set_blocking(handle, b);
24 unsigned Console::do_write(const char *buf, unsigned len)
26 check_access(M_WRITE);
28 return sys_write(handle, buf, len);
31 unsigned Console::do_read(char *buf, unsigned len)
35 unsigned ret = sys_read(handle, buf, len);
42 Console &Console::instance(Stream s)
44 static Console in(CIN);
45 static Console out(COUT);
46 static Console err(CERR);
51 case COUT: return out;
52 case CERR: return err;
55 throw invalid_argument("Console::instance");
58 Console &cin = Console::instance(Console::CIN);
59 Console &cout = Console::instance(Console::COUT);
60 Console &cerr = Console::instance(Console::CERR);