3 ms·
Per the man: > puts() and fputs() return a nonnegative number on success, or EOF on error. r is the result of the write, if it’s nonzero the write failed and
by masklinn 5y ago
Per the man:
> puts() and fputs() return a nonnegative number on success, or EOF on error.
r is the result of the write, if it’s nonzero the write failed and thus so did puts.
- m45t3r 5y agoYeah, but I think the question was why EOF and "\n". It could as easily just return 1 or -1 for example, and it would make more sense I think.
- kevin_thibedeau 5y agoputs() always adds a line termination so success means that '\n' is the last char for that implementation.
- masklinn 5y agoThat's more of an implementation detail, probably a BC remnant from when it called putchar in a loop and you’d get the result if the last putchar.