I know the concepts behind "fstream", like ifstream and ofstream, but what exactly is istream? For example, say there is a function with this heading:
What does that &input variable hold exactly? Can someone assist me with some examples? Thanks.
void ChangePrices(GroceryStore &store, istream &input);
// Precondition: Input is open for reading.
// Each line consists of a valid one word item name
// and a valid price.
// Postcondition: Changes the prices of items in store using names
// and new prices from input.
cin is a predeclared example of an istream, but you can declare others if you wish. I've not done it, but I suspect you could use an istream to get data from a port other than the one the keyboard is on, say data being downloaded from the internet, or maybe from a satellite, something other than a file per se'.
I believe fstreams are derived from istreamsa and ostreams. Therefore fstreams and ifstreams are all examples of istreams, too.