Binary Input using read() function.
CODING:
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
void main()
{
int i;
double d;
char c;
clrscr();
ifstream fin("info.dat");
fin.read(&c,sizeof(c));
fin.read((char *)&i,sizeof(i));
fin.read((char *)&d,sizeof(d));
cout<<c<<endl<<i<<endl<<d;
getch();
}
CODING:
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
void main()
{
int i;
double d;
char c;
clrscr();
ifstream fin("info.dat");
fin.read(&c,sizeof(c));
fin.read((char *)&i,sizeof(i));
fin.read((char *)&d,sizeof(d));
cout<<c<<endl<<i<<endl<<d;
getch();
}
Comments
Post a Comment