Robert Elz said:
| a reliable way | to determine whether 0 represents failure or buffer exhaustion
This is not necessary.
The cases can be distinguished by setting errno to 0 before the call, and checking afterwards (if 0 is returned) - if errno is set there was an error, if it is still 0, it is something else.
C has no requirement to leave errno unchanged on success. | The value of errno is zero at program startup, but is | never set to zero by any library function. The value of | errno may be set to nonzero by a library function call | whether or not there is an error, provided the use of errno | is not documented in the description of the function in this | International Standard. strftime is not documented as using errno, so that wording applies. This is because the library function may have to make a system call to check how to behave and that may fail. -- Clive D.W. Feather | If you lie to the compiler, Email: clive@davros.org | it will get its revenge. Web: http://www.davros.org | - Henry Spencer Mobile: +44 7973 377646