| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
2 questions
what is a good code to put in a program that will keep it open even if you type something to the console? nothing i have found works
what is a good way to make a program that closes others that are open? thanks in advance\ p.s im new to c++ |
|
#2
|
||||
|
||||
|
cin.get() -- This will freeze the program until you strick the <Enter> key
Closing other applications is tricky, and requires knowledge of the Windows API -- In short, it isn't easy. I have never done such a thing, and do not know the limitations of doing so.
__________________
Officially a member of the Itsacon fan club. Beer blasts are every friday at Viper_SB's house. I bring the chips. ![]() |
|
#3
|
|||
|
|||
|
well i think hitting enter is the problem becuase kets say the program asks for your name, then when u type your anme and hit enter it will ru nthroguh all the text that is displayed realy quick and then close. i think making space or another key other than enter to close might work but i dont know how to od that.
since closing programs is difficult i wont try it til i get a better grasp of c++ |
|
#4
|
||||
|
||||
|
fseek(stdin,0L,SEEK_END);
cin.get(); Those two lines will forward past everything in the keyboard's buffer and wait for the user to hit <Enter> again, regardless of whether they already have done so before.... |
|
#5
|
|||
|
|||
|
ok ill try that, thanks man
|
|
#6
|
||||
|
||||
|
hth
![]() |
|
#7
|
|||
|
|||
|
it worked, thanks again, u dont know how many people have told me a bunch of crap that doesnt work lol
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > 2 questions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|