Hi,I,m writing puts()function and I want to know that I which situations it returns EOF
I know that when there is an error it return EOF but whad does it mean.
can you give me an example?

Recommended Answers

If there's a write error to the destination stream, you'll get a return value of EOF. Typically this means something along the lines of the target device no longer being available or getting corrupted. However, since puts writes to stdout, this is rather unlikely unless you've redirected stdout to a …

Jump to Post

All 2 Replies

If there's a write error to the destination stream, you'll get a return value of EOF. Typically this means something along the lines of the target device no longer being available or getting corrupted. However, since puts writes to stdout, this is rather unlikely unless you've redirected stdout to a volatile location.

When this happens, the function should also set errno to a known value to indicate the error that occurred.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.