errno
A global (thread-local) error number set by library functions on failure.
Easy
errno = 0;
long v = strtol(s, &end, 10);
if (errno == ERANGE) puts("out of range");
perror() and strerror(errno) give a human-readable message.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.