LearnFrenzy
Sign in Take a free test

C Input / Output · Input/Output MCQ · Question 9

How to open a JPEG for reading in C Answer, explanation & discussion

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

Which call correctly opens photo.jpg to read its bytes?

  • A fopen("photo.jpg", "r")
  • B fopen("photo.jpg", "rb") Correct
  • C fopen("photo.jpg", "w")
  • D fopen(photo.jpg, "rb")
Correct Answer: Option B

Non-text data must be opened in binary mode so that no line-ending translation happens. On Windows "r" could corrupt the bytes; "rb" is correct everywhere.

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