I am trying to run this code below after I have compiled in C++.
The code do succesful when compiling.
When I doubleclick the program it starts but immediately the program encounters a problem and closes again.
What the code does is to read in values from a .txt file in arrays. As seen the arrays I am using has values like: Timearr[100000] etc...
If I change these to 10000 instead the program works and no problem occurs.
Could there be any idéas why this is happening ?
Code:
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
int main ()
{
std::string Datee;
char Comma;
int Timee = 0;
std::string Datearr[100000];
int Timearr[100000];
int CountArray = 100000;
ofstream MainFile;
MainFile.open ("MainFile.txt");
ifstream stockfile ("CCE.txt");
while ( getline(stockfile, Datee, ',') )
{
stockfile >> Timee;
stockfile >> Comma;
stockfile.get(); // read in trailing newline character
//////////////////////////////////////////////////////////////////////
// Read in File into Arrays (The Code is running now)
CountArray = (CountArray - 1); // CountDown for CountArray while all values is inserted for the arrays
Datee = Datearr[CountArray];
Timee = Timearr[CountArray];
} // End of While Statement
//////////////////////////////////////////////////////////////////////
return 0;
} // int main braces