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!