C++ Input from txt file size problem

Hello guys.

I finally accomplished what I'd asked for earlier.

I'm able to input data from txt file to c++ array.

the Text file contains around 60,000 lines "numbers" to be loaded into a c++ array to calculate some stuff.

I'm able to load 60,000 lines "txt file size 1.1MB" no problem, but sometimes when I try to load more lines "from a file around 1.4MB", the process terminates and gives me an error message "n.exe has stopped working, Windows is checking a solution to this problem" and Code::Block shows error "Process terminated with status -1073741819 "

Anyone has any ideas? that would be very much appreciated.

I'm using Code::Blocks on windows 8.1

Thanks a lot.
Are you performing bound checks before adding an item from the text file into the array?

By performing bound checks you can determine if you have more items than your array can hold and output an error message about the array not being big enough.

To overcome the limitation of the fixed size of an array you could try adding the items from the text file into an stl::list.
Use a std::vector or std::decque instead of an array allocated on the stack.
Topic archived. No new replies allowed.