what is the syntax for that?
if (xxx.txt exist)
{
......
}
thank you
what is the syntax for that?
if (xxx.txt exist)
{
......
}
thank you
Code:#include<fstream.h> // include on top of program ifstream fin("C:\\ONEDIR\\SECOND\\FILE.TXT"); if(fin.fail()) cout << "Can't open the file or it doesn't exist!";
that's one way of doing so, i'm taking for granted that you know a bit about file streams b/c i'm not including any comments here
and using just lines of instructional code without it's proper placement representation withing a function..
oh yeah,,,,,,,,,, and if it does exist then it will get opened so you must close it after, that is if you don't intend on using it
Code:fin.close();
Code:ifstream X; X.open ("filename"); if (!X) { //do whatever }
thanks..... i will try that out!!