I am writing to a text file using the write function with the file descriptor set a O_NONBLOCK.
fd = open(filepath, O_RDWR | O_NONBLOCK , 0777);
write(fd, string, size);
The questions I have are as following:
How large is the file buffer size until it is blocked?
If I am using O_NONBLOCK as above, what would happen if the buffer is already full? The string would be dropped?
So for the O_NONBLOCK for write, I should always check the return value of write to see whether it is the same as the length of the string we want to write?
How do I test the phenomena of the file write buffer is full? I have created an arbitary long string in writing but it seems that I still couldn't produce the effect string drop.
Thanks.