On Wednesday, 30 July 2025 at 19:45:20 UTC, Andy Valencia wrote:
but I'd like to understand what's up before just changing my code to assume 0 is a success value?
AFAICT your code is wrong. The parameters of `fread()` are `ptr`, `size`, `n`, `stream`.Your code is attempting to read `1` unit with a size of `buf.length`. If the stream has less then a single unit of size `buf.length` left, it has obviously read 0 units. Which it reports.