Console Crash

I'm writing a program for class and any help is appreciated. I'm not able to get anywhere because my console crashes and I get no debugging results.

When I run the program the error appears as follows:
"Debug Assertion Failed!

Program C:\....Assn13.exe
File F:\dd\vctools\crt\crtw32\convert\isctypr.c
line 56

Expression c>=-1&& c<=255"

Here is the code I'm trying to run.

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <fstream>
using namespace std;

/*****************************************************************************

*****************************************************************************/
int main()
{
	const int SIZE = 2000;
	char file[SIZE];
	int count = 0;
	int length,
		upperCount = 0,
		lowerCount = 0,
		digitCount = 0;

	ifstream text;

	text.open("C:\\CPPFiles\\text.txt");

	while (count < SIZE && text >> file[count])

		text.close();

	length = strlen(file);

	for (int count = 0; count < length; count++)
	{
		if (isupper(file[count]))
			upperCount++;

		if (islower(file[count]))
			lowerCount++;

		if (isdigit(file[count]))
			digitCount++;

	}

	cout << "Uppercase characters: " << upperCount << endl;
	cout << "Lowercase characers: " << lowerCount << endl;
	cout << "Digits: " << digitCount << endl;

	return 0;
}


I'm kind of dependent on the debugging console for my error checking so please let me know if there is anything completely bonkers.

I appreciate the help.
`strlen()' expects a null terminated string

Also
1
2
	while (count < SIZE && text >> file[count])
		text.close(); //¿? 
Topic archived. No new replies allowed.