Using a Function to read from a .txt

Hello,
I'm having problems writing a function to pull data from a .txt file. I know my function call has to be wrong, but I'm not quite sure how to issue that command. Is there anything else I am doing wrong with the Prototype or Definition?

.txt first line:
1
2
 
J Jones 33567 25000.00 30 1 


Function Prototype:
1
2
 
int fileRead(ifstream& inFile, string& fName, string& lName, int custID, float yIncome, float min, int agentID); 


Function Call:
1
2
 
fileRead(inFile, fName, lName, custID, yIncome, min, agentID); 


Function Definition:
1
2
3
4
 
void fileRead(ifstream& inData, string fName, string lName, int custID, float yIncome, float min, int agentID){ 
 while(inData >> fName >> lName >> custID >> yIncome >> min >> agentID); 
 }


EDIT: Fixed yIncome to be float.
Last edited on
int yIncome is reading from a double in the file, which will garble the stream I think.
Oh derp, I had that set as a float in the original program.
I switched that up, I'll have to edit the original question.
Thank you jonnin.

When I compile I get the following:

undefined reference to `fileRead(std::basic_ifstream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int, float, float, int)'

Topic archived. No new replies allowed.