LearnFrenzy
Sign in Take a free test

Error Handling · Error Handling MCQ · Question 4

perror() vs strerror() – the difference Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 4 Back to Exercise

What is the difference between perror() and strerror()?

  • A perror prints a message for the current errno to stderr; strerror returns the message text for an error number Correct
  • B None
  • C perror returns a string; strerror prints it
  • D strerror exits the program
Correct Answer: Option A

perror("config") → "config: No such file or directory" on stderr. strerror lets you put the text into your own message or log.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links