V
vippstar
What happends if I try to read from a stream which has been opened
with "w" mode, either with fgets or some other function?
with "w" mode, either with fgets or some other function?
What happends if I try to read from a stream which has been opened
with "w" mode, either with fgets or some other function?
So what happends is a read error and not undefined behavior.fgets, C89:
If a read error occurs during the operation, the array contents
are indeterminate and a null pointer is returned.
Some of the other functions return EOF instead of a null pointer,
or return an unusual count -- depends on the exact function.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.