Cant access a .txt file?

So i made a code that would make a .txt file called Game.txt, then the user would be able to input data into that file, and press ctrl-z to mark the end of the file. That code works fine, but then in the next tutorial it was how to access stuff from that file and print it out in the screen. The text file made with the first code looks as follows:

1 sally 20.23
2 peter 324.21
3 mark 34.12

Where first number corresponds to an int called id, the second to a string called name, and third to a double called money, looping 3 times. (if it would help to also put the code for how the file was made i could do so too.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "stdafx.h"
#include "iostream"
#include <string>
#include <fstream>

using namespace std;


int _tmain()
{
	ifstream theFile ("Game.txt");

	int id;
	string name;
	double money;
		while(theFile >> id >> name >> money)
	{
		cout << id << ', ' << name << ', ' << money << endl;
	}
	getchar();
	return 0;
}


The console application shows up, and there are no errors, but i am expecting the Game.txt contents to be printed out, whereas i get a blank console application screen.
Topic archived. No new replies allowed.