-#ifdef WIN32
- DWORD ret;
- if(WriteFile(handle, buf, size, &ret, 0)==0)
- throw system_error("WriteFile");
-#else
- int ret = ::write(handle, buf, size);
- if(ret==-1)
- {
- if(errno==EAGAIN)
- return 0;
- else
- throw system_error("write");
- }
-#endif
-
- return ret;