as we discussed offline  you are working at a runtime system  you should be prepared to get your hands dirty streams do not support exclusive locking streams cannot be constructed from fds  with standard libraries your  newline  interpretation is wrong newline  is merely a separator  you ll need to code similar stuff over streams as well 