A
arunix
Hello All
here is one problem arise i am declaring a string type function
for open a file from the current directory but i dont know much about
the function type String
when i complie it it shows the Error
nonscalar conversion type int to string
at return 1 i dont understand please tell me about it.....
this code works fine without decaring it as function........
std :: string str_show(std :: string str_file)
{
std :: ifstream myfile;
std :: string line;
myfile.open(str_file.c_str());
if(!myfile)
{
std :: cerr << "Could Not open " ;;
return 1; // Error
}
else
{
while(true)
{
std :: getline(myfile,line);
if(!myfile) break;
std :: cout<< line << std:: endl;
}
}
here is one problem arise i am declaring a string type function
for open a file from the current directory but i dont know much about
the function type String
when i complie it it shows the Error
nonscalar conversion type int to string
at return 1 i dont understand please tell me about it.....
this code works fine without decaring it as function........
std :: string str_show(std :: string str_file)
{
std :: ifstream myfile;
std :: string line;
myfile.open(str_file.c_str());
if(!myfile)
{
std :: cerr << "Could Not open " ;;
return 1; // Error
}
else
{
while(true)
{
std :: getline(myfile,line);
if(!myfile) break;
std :: cout<< line << std:: endl;
}
}