Contain inside "status.txt":
The program code:
int fexists (char fname[])
{
int failed;
ifstream infile (fname, ios::nocreate);
failed = infile.fail();
infile.close();
return (!failed);
}
void main()
{
char fileName[50] ="status.txt";
FILE *fptr;
char buf[200];
if (fexists(fileName))
{
fptr=fopen( fileName , "r" );
while (fscanf(fptr, "%s", buf) != EOF)
{
cout<<buf<<endl;
}
}
}
ouput:
Quote:
AA
BB
CC
DD
Press any key to continue
|
The program requiremet is read the text file line per line,
so that the output is like this
Please help..
