Hello everyone,
I am trying to run a C++ program by booting into DOS Mode. I am using Borland Turbo C++ v3. I have to run this program in DOS itself because of its application.
Program has some basic graphic display stuff (color circle with gray background). When I open the tc.exe, then open the .cpp file and run the program, its working fine. The code is such that when I press a key on keyboard, it should halt/end the program and as usual go back to editor window. Here is the problem. When I press a key to end the program, the program stops but screen is turning blank (black) with a cursor blinking on it. Cursor is moving with the arrow presses on the keyboard. I am sure that the screen is going back to the turbo c++ editor where I ran the program initially. I am sure because, I tried to press ENTER key like around five times and restarted the computer. When I opened the code, I found those five blank lines in the code because of the ENTER presses. I guess I am opening and closing graphics correctly. These are the lines that I am using to open graphics mode.
int gdriver = DETECT, gmode;
initgraph (&gdriver, &gmode, "c:\\tc\\bin\\bgi");
To close the graphics I am using this line.
closegraph();
restorecrtmode();
I tried a small program which just opens graphics and closes graphics and halts the program on the press of a key (used getch()). Even for that, the screen is turning blank after halting the program.
Have no idea. Please share your views on this.
Hope I will find a solution soon.
Your help is highly appreciated.
Thanks,
Vallabh C
I am trying to run a C++ program by booting into DOS Mode. I am using Borland Turbo C++ v3. I have to run this program in DOS itself because of its application.
Program has some basic graphic display stuff (color circle with gray background). When I open the tc.exe, then open the .cpp file and run the program, its working fine. The code is such that when I press a key on keyboard, it should halt/end the program and as usual go back to editor window. Here is the problem. When I press a key to end the program, the program stops but screen is turning blank (black) with a cursor blinking on it. Cursor is moving with the arrow presses on the keyboard. I am sure that the screen is going back to the turbo c++ editor where I ran the program initially. I am sure because, I tried to press ENTER key like around five times and restarted the computer. When I opened the code, I found those five blank lines in the code because of the ENTER presses. I guess I am opening and closing graphics correctly. These are the lines that I am using to open graphics mode.
int gdriver = DETECT, gmode;
initgraph (&gdriver, &gmode, "c:\\tc\\bin\\bgi");
To close the graphics I am using this line.
closegraph();
restorecrtmode();
I tried a small program which just opens graphics and closes graphics and halts the program on the press of a key (used getch()). Even for that, the screen is turning blank after halting the program.
Have no idea. Please share your views on this.
Hope I will find a solution soon.
Your help is highly appreciated.
Thanks,
Vallabh C