- if(!(mode&M_WRITE))
- throw InvalidState("Console is not writable");
-
-#ifdef WIN32
- DWORD ret;
- if(!WriteFile(handle, buf, len, &ret, 0))
- throw SystemError("Writing to console failed", GetLastError());
-#else
- int ret = ::write(handle, buf, len);
- if(ret==-1)
- throw SystemError("Writing to console failed", errno);
-#endif