Quote:
"Exception thrown: read access violation.
search was 0x1.
If there is a handler for this exception, the program may be safely continued."
There is no way that a simple handling of the exception can allow your program to continue safely.
This message kindly tell you that you have a problem in 'pointer initializing', 'memory allocation' or 'pointer messing'. The problem can be a combination of the above.
The debugger is the best tool to track this kind of problem.
You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.
The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Debugger - Wikipedia, the free encyclopedia[
^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[
^]
The debugger is here to show you what your code is doing and your task is to compare with what it should do.
There is no magic in the debugger, it don't find bugs, it just help you to. When the code don't do what is expected, you are close to a bug.
Advice: take a sheet of paper and try to do it by hand, your program should use the same procedure.
Nota: a bug in CP have altered your code.