Hung File I/O

Trying to do some practice work, just wondering if anyone knows what is causing this file I/O to hang.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  int MorningRead (int i)
{
	
	int FL600 = 0;
	int Count = 0;
	
	ofstream myfile;
  	myfile.open ("FL600.txt");
  	
  	while (Count < i)
	{
  	FL600 = getchar();
  	Count++;
  	}
  	Count = 0;
  	FL600 = getchar();
  	myfile.close();
  	
	return FL600;
	
}


the file it's reading from looks like this:

11111
22222
33333
33333
What value(s) of i are you passing?
What is your problem?
I'm passing 0 to 19, but this function causes it to hang.

Eh, I'm tired and this was just for practice so if anyone comes up with an answer, that's cool, if not then meh who cares.
Last edited on
Not sure what its meant to do, but line 12 gets input from the user, not the file.
EDIT: Or is it supposed to store input into the file?
Last edited on
Ahhh, right. Thanks I was tired and typed in the wrong one, works now.
Topic archived. No new replies allowed.