Page 1 of 3
[Solved] Pause Function
Posted: Tue Jun 30, 2009 5:58 pm
by zodiac976
I made my own clear screen function with the win32 API with a lot
of help but now I need a pause function that waits till any key is hit.
I made a temporary one like cin.get() but you have to hit enter and
if you enter some wierd letter or strings it causes some weird loops
and bugs...so I am wondering if there is a function that waits for
the user to hit any possible key then continues on with the program
or maybe a way to error check cin.get()?
Oh by the way I don't want to rely on system("pause")...too many
bad things about it.
Re: Pause Function
Posted: Tue Jun 30, 2009 6:06 pm
by avansc
you need to learn to google shit seriously.
Re: Pause Function
Posted: Tue Jun 30, 2009 6:24 pm
by zodiac976
avansc wrote:you need to learn to google shit seriously.
I did google this for months and just stuck with system("pause") or
cin.get() which are very unreliable. I didn't ask for a google response
when I use google anyways, I asked for help on this topic. You remind
me of people that say read the manual, read the book, and then one
day they come across something they cannot figure out and then get
this response "use google" or "RTFM" from the same person or persons
. I think you get the idea.
Re: Pause Function
Posted: Tue Jun 30, 2009 6:39 pm
by Bakkon
Can you just make a "Zodiac Learns C++" thread instead of making a new one every day?
Re: Pause Function
Posted: Tue Jun 30, 2009 6:44 pm
by zodiac976
Bakkon wrote:Can you just make a "Zodiac Learns C++" thread instead of making a new one every day?
Maybe good idea.
Re: Pause Function
Posted: Tue Jun 30, 2009 6:47 pm
by programmerinprogress
I actually made one, but felt like an ass when I saw the regards post, thus didn't post it
Re: Pause Function
Posted: Tue Jun 30, 2009 7:03 pm
by zodiac976
programmerinprogress wrote:I actually made one, but felt like an ass when I saw the regards post, thus didn't post it
I don't get that..there isn't anything bad in that post.
just thanking the people helping.
Re: Pause Function
Posted: Tue Jun 30, 2009 7:04 pm
by avansc
cin.get and system are C++ centric, not win32api
so... how about you google something like this... and see where you get.
http://www.google.com/search?hl=en&clie ... f&oq=&aqi=
you might not like my posts. but im just being frank and honest. if you cant deal with that im sorry but you should just toughen up.
Re: Pause Function
Posted: Tue Jun 30, 2009 7:17 pm
by zodiac976
avansc wrote:cin.get and system are C++ centric, not win32api
so... how about you google something like this... and see where you get.
http://www.google.com/search?hl=en&clie ... f&oq=&aqi=
you might not like my posts. but im just being frank and honest. if you cant deal with that im sorry but you should just toughen up.
I am a C++ programmer not a windows programmer...
and the only code I have is for clearing the screen using the
win API which I have no clue what it means just that it clears
the screen under console. I rather have a C++ standard way of
clearing the screen without spamming newlines and not using
system("cls"). It only works with #include <windows.h>. That
is off topic anyways.
And is this windows programming:
http://www.google.com/search?hl=en&clie ... f&oq=&aqi=
If not set me straight.
Re: Pause Function
Posted: Tue Jun 30, 2009 7:18 pm
by voidcyrax
avan is right, if you cant even fucking google correctly, you should just give up... in life
zodiac, you are a dumbass, how can you not pause the app? If you're using a win32, then get win32 function, if you are using console apps, then use stream functions (cin, etc). if you're using directx, then get a directinput function,... for SDL use and sdl input function, etc. WHAT IS SO DIFFICULT!!??
it all depends on WHAT YOU ARE DOING!
Re: Pause Function
Posted: Tue Jun 30, 2009 7:24 pm
by zodiac976
voidcyrax wrote:avan is right, if you cant even fucking google correctly, you should just give up... in life
zodiac, you are a dumbass, how can you not pause the app? If you're using a win32, then get win32 function, if you are using console apps, then use stream functions (cin, etc). if you're using directx, then get a directinput function,... for SDL use and sdl input function, etc. WHAT IS SO DIFFICULT!!??
it all depends on WHAT YOU ARE DOING!
I can't pause the app? sure I can. I think you need to slow
down and read the above posts. I am looking for more
efficient way than system("pause") for example cause it
is just a huge security risk. I am not a windows programmer.
Why don't you give an example or if you are stubborn send
a link to lead me in the right direction instead of calling me
a quote you: "dumbass".
Re: Pause Function
Posted: Tue Jun 30, 2009 7:33 pm
by avansc
what exactly do you wanna do. just pause the program? because you can make a FSM that enters a pause state under certain conditions.
if you wanna respond to each key stroke you need to do some smart things. i would suggest with your experience level that you just use a library like sdl glut .... etc that does keyboard handling for you.
Re: Pause Function
Posted: Tue Jun 30, 2009 7:43 pm
by zodiac976
avansc wrote:what exactly do you wanna do. just pause the program? because you can make a FSM that enters a pause state under certain conditions.
if you wanna respond to each key stroke you need to do some smart things. i would suggest with your experience level that you just use a library like sdl glut .... etc that does keyboard handling for you.
Here is what I want to do and to be very specific I will
use one of my pause functions that work but it is not
very good.
EDIT: If this helps any I am doing all this code in console.
void pause()
{
cout << "Press ENTER to continue . . .";
cin.get();
}
The function will stop the program until they hit enter which I
rather have it be any key hit. If they type in characters and stuff
it just causes problems.
I am just trying to find a C++ standard way so I can stop using
everything related to system();
I did search this on google for months and they always have
Sleep(), system("pause") or almost the same thing as me.
The reason I brought this topic up was I thought since I can't
find anything on google or figure it out on my own yet I might
as well ask the forum.
Re: Pause Function
Posted: Tue Jun 30, 2009 7:46 pm
by voidcyrax
noooooooobb
noob noob noob noob!
all you have to do is replace cin.get, with get(). NOOB!
that way, once any character is inputted, the program continues on. NEEEEWWWWBBB!!
Re: Pause Function
Posted: Tue Jun 30, 2009 7:54 pm
by zodiac976
voidcyrax wrote:noooooooobb
noob noob noob noob!
all you have to do is replace cin.get, with get(). NOOB!
that way, once any character is inputted, the program continues on. NEEEEWWWWBBB!!
replace cin.get() with get() this is what happens.
I am doing this for your sake.
error C3861: 'get': identifier not found
Now read your post again..I think you get it now..
I hope
.