A questionnn :):)

Hii again.... i wanna to let the user to input the file path and the file name to open any file, so i wrote that:

cout<<"Please enter file name\n";
cin.getline(filename,256);
Fn=filename;

cout<<"please enter pathname\n";
cin.getline(filepath,256);
Fp=filepath;

Fp.append(Fn);
Fn=Fp;

fs.open(Fn.c_str());
if (fs.is_open())
{
while (! fs.eof() )
{
getline (fs,str);
cout << str << endl;
}
fs.close();
} }



but it doesn't work ....

thx in advance
i declared filename and filepath as string at first doesn't work so redeclared them as char []...
Topic archived. No new replies allowed.