> inData.close(); //closing first file
Although this really shouldn't be necessary, you may need to clear the error flags before opening the next file, so call clear() after the close():
Code:
inData.close(); //closing first file
inData.clear();
Code:
> while(!inData.eof()) //getting the multiple line file
> {
> inData.get(ch);
> cout << ch;
> }
Never use eof() to control a file reading loop. Instead use the return value of the read itself:
Code:
while(inData.get(ch)) //getting the multiple line file
{
cout << ch;
}