Why does write continuously leave 4K bytes in the buffer?
I have essentially the following code: int fileWrite(int file, void * pBuffer, size_t size) { size_t bytesWritten = (size_t)write( file, pBuffer, size ) ; if (bytesWritten != size) { return -1; } return 0; } It works if the size is 1GB, but when the size is ~2GB, it get 4K bytes left consistently. I can fix this by wrapping write in a loop and moving the buf