reading a .dat file

My assignment asks to take a data file full of numbers:
12 43
23 23
53 98
-43 0
I can open and read the file, but need to make a multi dimensional array. Line one says how many rows, and after I need to put the other numbers in the proper index. I can print one character at a time, but cannot have the program recognize when there is a new line, or a space. Here is what I have so far:

#include <cstdlib> // Provides size_t and EXIT_SUCCESS
#include <iomanip> // Provides setw
#include <iostream> // Provides cout
#include <cassert> // Provides assert()
#include <vector> // Provides the vector class!
#include <fstream>
using namespace std;

void file_open();
int main ()


void file_open()
ifstream getfile; ("shuttle.dat", ifstream::in);
int count = 0;

int ch = getfile.get();

while (getfile.good())
cout << (char)ch;
ch = getfile.get();


any ideas?
Topic archived. No new replies allowed.