Bulat M. Bulat M. - 1 month ago 15
Linux Question

What does it mean "short object count(or zero)?

While reading man page for fread/fwrite(GNU/Linux) functions met phrase:
if an error occurs, or the end of file is reached, the return value is a short item count(or zero).

Did not find that words in the dictionaries.
Could you please shed some light on meaning of that obscure words?
They are not very accurate and meaningful in my opinion.

Answer

Well, there's an alternate phrasing in the spce which I believe is clearer. Quoting C11, chapter ยง7.21.8.1, (emphasis mine)

The fread function returns the number of elements successfully read, which may be less than nmemb if a read error or end-of-file is encountered. If size or nmemb is zero, fread returns zero and the contents of the array and the state of the stream remain unchanged.