and also on Windows. Although Microsoft prefers to call it _stat() instead. :rolleyes:
Most of those POSIX functions start with _ on Windows.
Printable View
this functions searches for all the text files in the particular folder and returns their name in string pointer.Code:string* getFname()
{
if((hfile=_findfirst("C:/tr1/*.txt",&c_file))==-1)
{}
else
{
int position=0;
str[0]=c_file.name;
position++;
while(_findnext(hfile,&c_file)==0);
{
str[position]=c_file.name;
position++;
}
}
return str;
}
this files then uses the name of the file and do the manipulations i.e searches for the word in the file . I dont know how to deal with the pointers .The higlighted part of code is giving me errors.Code:int manipulation() const
{
fstream my_file; string line;
string::size_type found;
my_file.open ((file::getFname()).c_str());
{
if (my_file.is_open())
{
while ( getline(my_file,line) )
{
found=line.find(word);
if (found != string::npos){ return found; }
/*if (found == string::npos){ cout<<"NOT found"<<endl; }*/
}
my_file.close();
}
else { cout<<"File not opened"; }
}
}
cannot convert 'this' pointer from 'const FileManipulator' to 'file &'