0
Я создал двоичный файл, используя ios::binary
, но в моем файле отображается текст. Почему? и как я могу создать двоичный файл, который отображается в двоичном представлении.C++ двоичный файл
#include <iostream>
#include <fstream>
#include<iomanip>
using namespace std;
int main()
{
ofstream outputFile;
outputFile.open("lab11.bin", ios::binary | ios::out);
int marks,roll_no,n,i;
char name[100];
cout<<"\nEnter the no of students:\n";
cin>>n;
for(i=1;i<=n;i++)
{
cout<<"\nEnter name of student:\n";
cin>>name;
outputFile << name << "\n";
cout<<"\nEnter Roll no.:\n";
cin>>roll_no;
outputFile << roll_no<<"\n";
cout<<"\nEnter Marks:\n";
cin>>marks;
outputFile << marks<<"\n";
}
outputFile.close();
return 0;
}