A
arunix
Hello all,
here is a code to open the file....
how can i be better in this...
#include<iostream>
#include<string>
#include<fstream>
int main()
{
std :: string line;
char f_nme[20];
std :: ifstream myfile;
std :: cout <<"Please enter File name ";
std :: cin >> f_nme;
myfile.open(f_nme);
if(myfile.is_open())
{
while(!myfile.eof())
{
getline(myfile,line);
std :: cout<< line << std:: endl;
}
myfile.close();
}
else
{
std :: cout <<"Enable to Open The File " << std :: endl;
}
return 0;
}
Thanks
here is a code to open the file....
how can i be better in this...
#include<iostream>
#include<string>
#include<fstream>
int main()
{
std :: string line;
char f_nme[20];
std :: ifstream myfile;
std :: cout <<"Please enter File name ";
std :: cin >> f_nme;
myfile.open(f_nme);
if(myfile.is_open())
{
while(!myfile.eof())
{
getline(myfile,line);
std :: cout<< line << std:: endl;
}
myfile.close();
}
else
{
std :: cout <<"Enable to Open The File " << std :: endl;
}
return 0;
}
Thanks