Binary Output using write() function.
CODING:
#include<iostream.h>
#include<conio.h>d
#include<fstream.h>
void main()
{
clrscr();
ofstream fout("info.dat");
char c='K';
int i=69;
double d=66.66;
fout.write(&c,sizeof(c));
fout.write((char *)&i,sizeof(i));
fout.write((char *)&d,sizeof(d));
getch();
}
CODING:
#include<iostream.h>
#include<conio.h>d
#include<fstream.h>
void main()
{
clrscr();
ofstream fout("info.dat");
char c='K';
int i=69;
double d=66.66;
fout.write(&c,sizeof(c));
fout.write((char *)&i,sizeof(i));
fout.write((char *)&d,sizeof(d));
getch();
}
Comments
Post a Comment