Which C++ file mode is used to open a file in binary mode?

Options

  • A. ios::binary
  • B. ios::trunc
  • C. ios::ate
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. ios::binary

Detailed Explanation

Correct Answer: Option A — ios::binary

Explanation: ios::binary requests binary rather than text-mode file handling. It is useful for reading or writing raw bytes, images, and other binary data.