I have a school project in which need to create a function that takes a File Object as a Reference Parameter. Supposedly, it should allow me to read the first piece of data from others separated by a space from a file. The later be able to continue reading from the next piece of data.
I know how to set things up to read from the data file, such as using, andCode:#include <iostream>I also understand how to pass a variable by reference to a function. But I simply cannot put the two items together!Code:ifstream inputFileName; inputFile.open ("nameOfFile");
I tried using
In the function I usedCode:void getFileInput (ifstream &); //parameter getFileInput ("nameOfFile") // call void getFileInput (ifstream &dataFileName)
I'm just not getting an understanding of this concept! If you could help understand I would be quite appreciative!!Code:ifstream inputFile; inputFile.open (dataFileName);