How to read file data and input it into an array?

How do you get data from a file and store it all into an array?
For example if you had a file that stored
6 6 8 8
1 9 4 8

How can you turn that into an array like [6, 6, 8, 8, 1, 9, 4, 8]

What language are you talking about? It’s different for each one.

for c++:

freopen("file", "r", stdin);
vector<int> arr; int temp;
while (cin >> temp) arr.push_back(temp);

I’m using c++

@above
tysm