#includeIn this example, we create an instance of ofstream with the filename "example.txt" in binary mode. We then create an integer array and write its contents to the file using the write() method. Finally, we close the file. Package/Library: This is part of the C++ Standard Library, which is included in many C++ development environments such as GCC, Visual Studio, and Clang.using namespace std; int main() { ofstream file("example.txt", ios::binary); int data[] = {1, 2, 3, 4, 5}; file.write(reinterpret_cast (data), sizeof(data)); file.close(); return 0; }