Transferring File Contents

How can you go about putting the contents of a .txt file into an array?
That depends greatly on what's in the .txt file and what you're trying to do. Give us some more information.
I am doing a program which requires me to take the .txt file, "phone.txt", take all of its content (putting it in arrays), move that content into a new temporary file, as well as all of the new, user added content (which I have stored in arrays already). I need help in finding out how to get the data from phone.txt into my arrays. Not that it will help much, but here is the beginnings of my code, including the user inputted data being stored into two arrays.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream.h>
#include <stdlib.h>
#include <lvp\string.h>
#include <fstream.h>
#include <lvp\vector.h>

int main()
{
	int a;
	cout << "\n\n\n\n\n\t\tHow many contacts would you like to add? ";
	cin >> a;
	cout << flush;
	system("cls");
	cout << "\n\n\n\n\n";
	vector<String>name(a);
	vector<String>numb(a);
	
	for (int b=0; b<=a-1; b++)
	{
		cout << "\t\t\t  Name: ";
		cin >> name[b];
		cout << "\n\t\t\tNumber: ";
		cin >> numb[b];
		cout << "\n\n\n";
	}

	return(0);
}
Topic archived. No new replies allowed.