I have downloaded and installed turbo c in vista.
i can make programmes,too.
but i open a programme.when the programme is done the screen is automatically closed.
i can't see the result.
please help.
ex:
enter th value of a:
i have entered 10
enter the value of b:
ihave entered 23.
and when i push the enter the screen is closed.
Turbo c vista problem....HELP PLEASE?
At the end of the program add any ONE of the following lines:
getch();
system("PAUSE");
At least one of those should work. Either will hold the window open until the user presses a key.
Reply:There is 2 alternative:
1. If you could, just add "getch()" before the last line of the code. It will tell the compiler to "press any key to continue".
2. Start the program inside Command Prompt. Open Command Prompt, then type the full path to the EXE file, then hit Enter! After the code finishes, it will return to Command Prompt and of course, you can see the result. Type exit to quit Command Prompt.
Reply:Turbo C runs on Windows 2000 but it is a problem on later operating systems. Turbo C is really really old (1987).
There are free C compilers, such as GCC (GNU) that work on Windows. But that one only works at the command line.
Reply:If you read certain basic tutorials like http://www.cprogramming.com/tutorial/c/l... you'll understand what happens.
You have a console program. It is intended to be run from the command line. Therefore, the optimal solution is to open up a command line in Vista and run your program from there.
The other solution, which is really a hack only seen in beginner programs, is to request user input. That means that after your program is done running (the real code), it will wait for user input. So the window stays open.
You can do this by adding a getchar() at the end. You can also use the system command (#include %26lt;stdlib.h%26gt;) and do something like system("pause") or the like.
All the information I gave you is easily found with Google. If you intend to progress as a programmer, start using Google more often.
Reply:Hello:
It sounds like you're launching your program from a shortcut icon? And it's a console app...
You can make console apps stay open after they terminate by calling them differently:
cmd /K pathname\programname
So, let's say for example that I created a program called "test.exe" and it was located in C:\bin. I can call my program from a shortcut icon like this:
CMD /K C:\bin\test.exe
It's not case sensitive, so you can do it all in lower case if that's your preference. You may also find it necessary to use COMMAND.COM instead of CMD.EXE. It is included with NT versions for backward compatibility with DOS apps. If you're using a late enough version of the Borland compiler, it will produce native 32-bit console applications, thus only CMD will work. I doubt you're using a 32-bit version, however, because that stopped calling their inexpensive development tools "Tubro" way back in the 16-bit days.
Hope that helps!
Cheers!
Update:
COMMAND.COM is probably gone from Vista. I forgot that they trimmed backward compatibility out of Vista wherever they could get away with it. CMD should still launch your app with the /K switch though.
floral bouquets
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment