Apologies, I don't have too much time to look at this at the moment. However, in the case of the first program, you should check the return value of write() and see if the write is supposedly successful or not.
Apologies, I don't have too much time to look at this at the moment. However, in the case of the first program, you should check the return value of write() and see if the write is supposedly successful or not.