>From what I've seen typically people check if the value is -1 and call
perror() if it is and then fail whatever they were doing.

--Stephen

On Sun, Oct 06, 2024 at 02:48:56PM -0300, Gustavo Rios wrote:
> Hi folks!
> 
> I am programming in obsd using the c coding language. I have a doubt
> related to parameters and return value of write. My doubt is related to the
> fact that write has a parameter of the number of bytes to write in
> non-negative value. But it returns a signed value. Lets  suppose  i specify
> as the parameter a number of bytes to write with the size of 2 ^ 31 - 100;
> the internal represetation of signed and unsigned is the same, for
> instance, -100 and 2^31 - 100 is the same value.
> 
> In this scenario, how to handle a negative value of the return that is not
> a error as signess result  but is negative.
> 
> How do you handle this?
> 
> Thanks.
> 
> PS: sorry for my poor english.
> 
> -- 
> The lion and the tiger may be more powerful, but the wolves do not perform
> in the circus

Reply via email to