Thursday 29 April 2021

File Handling in C++ Qus - 1

 #include<iostream.h>

#include<fstream.h>

#include<conio.h>

int main()

{

clrscr();

ofstream fout;

fout.open("28AP.txt",ios::out);

fout<<"Hello from File Handling";

fout.close();

cout<<"File Created Successfully"<<endl;

ifstream fin;

fin.open("28AP.txt",ios::in);

char ch;

cout<<"Data of File"<<endl;

while(!fin.eof())

{

//fin>>ch;

fin.get(ch);

cout<<ch;

}

fin.close();

getch();

}

No comments:

Post a Comment