Tuesday 24 February 2015

Binary File Handling in C++

#include<iostream.h>
#include<conio.h>
#include<fstream.h>
main()
{
clrscr();

ofstream out("Items.txt",ios::out|ios::binary);

for(int i=65;i<91;i++)
out.put(char(i));
out.close();

ifstream in("Items.txt",ios::in|ios::binary);
char ch;
while(in)
{
in.get(ch);
cout<<ch;
}
out.close();
getch();
}

No comments:

Post a Comment