Hi guys. In this code I want to change it get the information from a file instead of the keyboard.

Code:
int main()
{
	vector<bowarrowcmb> bowandwt;
	bowarrowcmb record;
	streamsize prec = cout.precision();
		
	cout << "Enter a bow weight followed by a series of arrow weights: \n\n";
	while (read(cin, record)) {
		bowandwt.push_back(record);
	}

	typedef vector<bowarrowcmb>::size_type vec_sz;
	vec_sz size = bowandwt.size();

	if (size == 0)
		throw domain_error("Empty vector");


	system("CLS");
	for(vector<bowarrowcmb>::size_type i = 0;
		i != bowandwt.size(); ++i) {
		cout << bowandwt[i].bowt;
		for( int j = 0; j != bowandwt[i].arwt.size(); ++j){
			cout << " " << setprecision(4) << gpi(bowandwt[i].arwt[j],bowandwt[i].bowt);
		}
		cout << endl;
	}
	setprecision(prec);

	system("pause");

	return 0;
}
I think that what i need to do is to load the contents of the file line by line into bowandwt. I don't know how to do that. Can some please point me in the right direction how to do that? I've looked at file read snippets on the internet but don't know how to modify What I've seen for what I need. The following code that I copied from a website sums integers and works and is what I'm basing my learning from.
Code:
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;

int main() {
    int sum = 0;
    int x;
    ifstream inFile;
    
	inFile.open("C:\\Users\\matos\\Documents\\TxtDocs\\test.txt");
    if (!inFile) {
        cout << "Unable to open file";
        exit(1); // terminate with error
    }
    
    while (inFile >> x) {
        sum = sum + x;
    }
    
    inFile.close();
    cout << "Sum = " << sum << endl; 

	system("pause");

    return 0;
}