Hi,
Make 'len' a pointer instead, and indicate how much of the string was written. The return value will either be the same as 'len' or a negative number indicating an error condition.
I would follow the unix write syscall semantic here and report the number of written bytes using the return value. Matter of taste though.
cheers, Gerd