Fix includes in WriterApi.hh
Set errno to 0 on successful write

as specified in capi.h.
Handle domain error in write function
Test write function against error from API
Merge pull request #115 from magicant/fix/writer

Fix write function