// ============ This is line 13 in code ====================
class LotteryNumbers // creates a class called LotteryNumbers
{
public:
int m_Month;
int m_Day;
int m_Year;
int m_First;
int m_Second;
int m_Third;
int m_Fourth;
int m_Fifth;
int m_Sixth;
// constructor function
LotteryNumbers ()
{
m_Month = 0;
m_Day = 0;
m_Year = 0;
m_First = 0;
m_Second = 0;
m_Third = 0;
m_Fourth = 0;
m_Fifth = 0;
m_Sixth = 0;
} // close constructor
}; // close class definition
#define FALSE 0
#define TRUE 1
int main()
{
// instantiate an object of the LotteryNumbers class and call it Data.
// Thus, Data is a vector of LotteryNumber Objects
vector<LotteryNumbers> Data;
//Create a vector of characters, call it RawData. RawData will hold every single
//character from the raw data file, so that the program can analzye them.
vector<char> RawData;
//various variables used in the program
char mychar = ' ';
int CharCount = 0;
int Vec_Count = 0;
int month_key = 0;
int day_key = 0;
int year_key = 0;
int foundmatch = 0;
int firstball = 0;
int secondball = 0;
int thirdball = 0;
int fourthball = 0;
int fifthball = 0;
int sixthball = 0;
//int frequencies[53]; //an array which will be used to hold the number of times each number is picked.
//for(int iii = 0; i < 53; i++)
//frequencies[i] = 0;
//Opens "C:\\tmci\\RawData\\FL_RawData.txt" for reading the file
ifstream a_file ( "C:\\tmci\\RawData\\FL_RawData.txt" );
if (!a_file )
{
cout << "Can't open input file" << " FL_RawData.txt " << endl << endl;
cin.get();
cin.ignore(1);
exit(1);
} // close ifstream
// ====== The following is Loading RawData into a Vector (not an array) ============
// this loads every single character from Fla_RawData.txt into the vector of characters
// named RawData. It also counts the number of characters in the RawData file.
for( int i = 0; a_file; i++){
RawData.push_back(mychar);
a_file >> RawData[i];
CharCount++;
}// end for loop to load in the Raw Data
//===== This ends Loading RawData into a Vector =================
//add 30 blanks at the end of (vector<char> RawData) to avoid overrun when examing the vector
for(int i = 0; i < 30; i++)
RawData.push_back(mychar);
//increment CharCount to account for the 30 blanks we added at the end of the file
CharCount = CharCount + 30;
// ============ This is line 110 in code ==============================
After this come 64 different cases of numbers that have single digits and two digits combinations...my code continues with:
int frequencies[53]; //an array which will be used to hold the number of times each number is picked.
for(int i = 0; i < 53; i++)
frequencies[i] = 0;
// ================== This is line 1307 in code ========================
cout << "You have chosen to view the frequency distribution list " <<endl<<endl;
for(int i = 0; i < Vec_Count; i++)
{
frequencies[(Data[i].m_First)-1]++;
frequencies[(Data[i].m_Second)-1]++;
frequencies[(Data[i].m_Third)-1]++;
frequencies[(Data[i].m_Fourth)-1]++;
frequencies[(Data[i].m_Fifth)-1]++;
frequencies[(Data[i].m_Sixth)-1]++;
}
for(int i = 0; i < 53; i++)
{
cout <<" #" << i+1 << "=" << frequencies[i] << ", ";
if(((i+1) % 7) == 0)
cout << endl<<endl;
}
//reset the frequencies array back to zero, in case the user wants to run this again
for(int i = 0; i < 53; i++)
{
frequencies[i] = 0;
}
// space
system("pause");
return 0;
}
The error code is:
1 2 3 4 5 6 7 8 9 10 11 12 13
First-chance exception at 0x775af9d2 in newFla.exe: 0xC0000008: An invalid handle was specified
Call Stack
> ntdll.dll!775af9d2()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!775af9d2()
ntdll.dll!775f5173()
ntdll.dll!775c9ec5()
Output window
'newFla.exe': Loaded 'ImageAtBase0x4a420000', Loading disabled by Include/Exclude setting.
'newFla.exe': Unloaded 'ImageAtBase0x4a420000'
First-chance exception at 0x775af9d2 in newFla.exe: 0xC0000008: An invalid handle was specified.
Can anyone please explain these errors (plain English please) and how to correct them?
It means you've screwed up your code somewhere. Probably with a bad pointer. The system would like to tell you more but this is all it has. If you build with debugging symbols, you will get more information when it crashes.
Hi Moschops,
Thanks for your reply. I am a newbie self-teaching coder to c++. What are... how to use "build with debugging symbols? I use windows 7(64bit) OS and Visual Studio 2010 as my IDE. I do not know how to use the debugger yet. How does one find errant pointers in a code? I really appreciate your help! This error has me stumped.