I was writing a program, and for debugging, used the system("pause") command. I am running Windows XP.
Its an MS-DOS app, programmed in Dev-C++. But the program, when compiled, runs differently each time, without recompiling and without changing the code. Also, system pause sometimes exits the program and sometimes runs(the differences are whether it runs normally or exits). I did get a system error-Mis called Windows function- from the compiler itself, not the program. I have never had problems with this function before, and I am not using it in any new way.
I wrote the program on a bumpy car ride- did this damage the hard drive? It does have a gyro sensor to stop rotation, but...
For a test, I put 7-8 of the commands in a row. At one point, it worked fine. Then later, I put it in a for loop later in the program, and only 1-3 execute before the program unexpectedly ends. There are no extra return statements. Here is the body of code that crashes, although I have had the same error at random points in other sections of the program and involving other functions (like cout).
Expand|Select|Wrap|Line Numbers
- for (int i=0; i<10; i++) {
- cout<<"looping"<<endl;
- system("pause");
- system("pause");
- system("pause");
- system("pause");
- system("pause");
- system("pause");
- system("pause");
- system("pause");
- }