I'm trying to pass all read values into a converter and have it convert each individual number into Mins/secs, but I'm not sure how to pass the Read values into another function.
void read_file(std::string fileName, std::vector<double> lengths);
int main();
std::vector<double> len;
std::string fileName;
// you provide your program a way to set the input file name
read_file(fileName,len);
// do interesting stuff with the vector len
return 0;
}
void read_file(std::string fileName, std::vector<double> lengths){
std::ifstream inFile(fileName);
double songLength;
if (!inFile.open())
{
cout << "\nError opening file\n";
}
//intial Read
while (inFile >> songLength){
len.push_back(songLength);
std::cout << songLength << std::endl;
}
inFile.close();
}