Skip to main content
Commonmark migration
Source Link

Personally I like this approach:

From the man page: "Return Value -- On success, zero is returned. On error, -1 is returned, and errno is set appropriately."

 

This is followed by a list of errno codes and their causes. Which one of these is causing your failure will be apparent when you check the value of errno. The perror and strerror functions can automatically map the numeric value of errno to a short description.

It provides the next step in debugging (check errno), proves that what they need is in the documentation (the man page, specifically), and doesn't save them from actually having to read the documentation themselves.

The link too is helpful, but there are other ways to get a copy of the man page, so even if the link breaks the answer is still useful.

Personally I like this approach:

From the man page: "Return Value -- On success, zero is returned. On error, -1 is returned, and errno is set appropriately."

 

This is followed by a list of errno codes and their causes. Which one of these is causing your failure will be apparent when you check the value of errno. The perror and strerror functions can automatically map the numeric value of errno to a short description.

It provides the next step in debugging (check errno), proves that what they need is in the documentation (the man page, specifically), and doesn't save them from actually having to read the documentation themselves.

The link too is helpful, but there are other ways to get a copy of the man page, so even if the link breaks the answer is still useful.

Personally I like this approach:

From the man page: "Return Value -- On success, zero is returned. On error, -1 is returned, and errno is set appropriately."

This is followed by a list of errno codes and their causes. Which one of these is causing your failure will be apparent when you check the value of errno. The perror and strerror functions can automatically map the numeric value of errno to a short description.

It provides the next step in debugging (check errno), proves that what they need is in the documentation (the man page, specifically), and doesn't save them from actually having to read the documentation themselves.

The link too is helpful, but there are other ways to get a copy of the man page, so even if the link breaks the answer is still useful.

Source Link
Ben Voigt
  • 283.2k
  • 10
  • 110
  • 146

Personally I like this approach:

From the man page: "Return Value -- On success, zero is returned. On error, -1 is returned, and errno is set appropriately."

This is followed by a list of errno codes and their causes. Which one of these is causing your failure will be apparent when you check the value of errno. The perror and strerror functions can automatically map the numeric value of errno to a short description.

It provides the next step in debugging (check errno), proves that what they need is in the documentation (the man page, specifically), and doesn't save them from actually having to read the documentation themselves.

The link too is helpful, but there are other ways to get a copy of the man page, so even if the link breaks the answer is still useful.