Sunday, 28 April 2013

Character Write adn Read Program in which character by character Data is saved to the file and then Read from the file in turboo 's bin folder

//program stores characters until escape key is not pressed

#include<iostream.h>
#include<fstream.h>
#include<conio.h>

void main()
{
char ch;
ofstream as("test.txt");
clrscr();
while(ch!=27)
{
ch = getche();
//obj.put(character);
as.put(ch);
if(ch=='\r')
cout<<endl;
}
}

//read character by character data from the file :D
//umarjaved01@gmail.com

#include<iostream.h>
#include<fstream.h>
#include<conio.h>

void main()
{
char ch;
ifstream as("test.txt");
clrscr();
while(as)
{
as.get(ch);
cout<<ch;
}
}