get() wouldn't works since no standard function is called that. fucking retard.stupid retard 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!!
[Solved] Pause Function
Moderator: Coders of Rage
- M_D_K
- Chaos Rift Demigod
- Posts: 1087
- Joined: Tue Oct 28, 2008 10:33 am
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C/++
- Location: UK
Re: Pause Function
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
Re: Pause Function
ok, so I made one mistake. it is getchar(). so fucking what? do i still have to write it for you too?
listen, i understand you are a really bad newb, so let me try to help you here:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
...
getchar()
...
}
NEWB!!!
listen, i understand you are a really bad newb, so let me try to help you here:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
...
getchar()
...
}
NEWB!!!
- M_D_K
- Chaos Rift Demigod
- Posts: 1087
- Joined: Tue Oct 28, 2008 10:33 am
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C/++
- Location: UK
Re: Pause Function
still won't compile since it's incorrect code.
n00b.
n00b.
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
Re: Pause Function
mdk is nothing but fail. has to protect other users, and has to butt in things that don't concern him. the code is correct. the only thing missing is the semicolon, which im not going to fix for scriptkiddy zodiac, he can do it himself.
- zodiac976
- Chaos Rift Regular
- Posts: 156
- Joined: Thu Jun 18, 2009 10:03 am
- Current Project: Booklet & Text RPG
- Favorite Gaming Platforms: PC, PS3, PSP
- Programming Language of Choice: C++
- Location: AL
- Contact:
Re: Pause Function
That doesn't work it only responds to 'ENTER'voidcyrax wrote:ok, so I made one mistake. it is getchar(). so fucking what? do i still have to write it for you too?
listen, i understand you are a really bad newb, so let me try to help you here:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
...
getchar()
...
}
NEWB!!!
and if you use getchar() like that it causes
more problems than cin.get().
I think you are using C includes...
these are for c++
#include <cstdio>
#include <cstdlib>
EDIT: you so funny :D.
- zodiac976
- Chaos Rift Regular
- Posts: 156
- Joined: Thu Jun 18, 2009 10:03 am
- Current Project: Booklet & Text RPG
- Favorite Gaming Platforms: PC, PS3, PSP
- Programming Language of Choice: C++
- Location: AL
- Contact:
Re: Pause Function
Actually I think I found something that is working better
than cin.get();.
void pause()
{
cout << "Press ENTER to continue . . .";
cin.ignore(9999, '\n');
}
No more bugs but still you have to hit 'ENTER'.
than cin.get();.
void pause()
{
cout << "Press ENTER to continue . . .";
cin.ignore(9999, '\n');
}
No more bugs but still you have to hit 'ENTER'.
Re: Pause Function
zodiac976 wrote:Actually I think I found something that is working better
than cin.get();.
void pause()
{
cout << "Press ENTER to continue . . .";
cin.ignore(9999, '\n');
}
No more bugs but still you have to hit 'ENTER'.
yeah thats a brilliant way of doing it.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
- zodiac976
- Chaos Rift Regular
- Posts: 156
- Joined: Thu Jun 18, 2009 10:03 am
- Current Project: Booklet & Text RPG
- Favorite Gaming Platforms: PC, PS3, PSP
- Programming Language of Choice: C++
- Location: AL
- Contact:
Re: Pause Function
I found another way and tested it in my text RPG and
so far it works without relying on the 'ENTER' key but
I don't think it is a C++ standard.
You need #include <conio.h> to get it to work.
I thought conio was for some other compiler...
EDIT: I use visual C++ 2008 Express Edition.
void pause()
{
cout << "Press any key to continue . . .";
_getch();
}
I tried using just getch() and the compiler said to use
_getch(). So far I haven't gotten any errors with it.
so far it works without relying on the 'ENTER' key but
I don't think it is a C++ standard.
You need #include <conio.h> to get it to work.
I thought conio was for some other compiler...
EDIT: I use visual C++ 2008 Express Edition.
void pause()
{
cout << "Press any key to continue . . .";
_getch();
}
I tried using just getch() and the compiler said to use
_getch(). So far I haven't gotten any errors with it.
Re: Pause Function
You're dumb go awayvoidcyrax wrote:You all suck
01001110
00110000
00110000
00111000
!!!!!!!!!!!!
Re: Pause Function
system("PAUSE"); in general is a bad idea. If you had googled it you would have found this article:
http://www.gidnetwork.com/b-61.html
Let me quote it:
http://www.gidnetwork.com/b-61.html
Let me quote it:
*
t's a very expensive and resource heavy function call. It's like using a bulldozer to open your front door. It works, but the key is cleaner, easier, cheaper. What system() does is:
1.
suspend your program
2.
call the operating system
3.
open an operating system shell (relaunches the O/S in a sub-process)
4.
the O/S must now find the PAUSE command
5.
allocate the memory to execute the command
6.
execute the command and wait for a keystroke
7.
deallocate the memory
8.
exit the OS
9.
resume your program
There are much cleaner ways included in the language itself that make all this unnessesary.
*
You must include a header you probably don't need: stdlib.h or cstdlib
It's a bad habit you'll have to break eventually anyway.
Instead, use the functions that are defined natively in C/C++ already. So what is it you're trying to do? Wait for a key to be pressed? Fine -- that's called input. So in C, use getchar() instead. In C++, how about cin.get()? All you have to do is press RETURN and your program continues.
- zodiac976
- Chaos Rift Regular
- Posts: 156
- Joined: Thu Jun 18, 2009 10:03 am
- Current Project: Booklet & Text RPG
- Favorite Gaming Platforms: PC, PS3, PSP
- Programming Language of Choice: C++
- Location: AL
- Contact:
Re: Pause Function
I knew and know that :/.dejai wrote:system("PAUSE"); in general is a bad idea. If you had googled it you would have found this article:
http://www.gidnetwork.com/b-61.html
Let me quote it:*
t's a very expensive and resource heavy function call. It's like using a bulldozer to open your front door. It works, but the key is cleaner, easier, cheaper. What system() does is:
1.
suspend your program
2.
call the operating system
3.
open an operating system shell (relaunches the O/S in a sub-process)
4.
the O/S must now find the PAUSE command
5.
allocate the memory to execute the command
6.
execute the command and wait for a keystroke
7.
deallocate the memory
8.
exit the OS
9.
resume your program
There are much cleaner ways included in the language itself that make all this unnessesary.
*
You must include a header you probably don't need: stdlib.h or cstdlib
It's a bad habit you'll have to break eventually anyway.
Instead, use the functions that are defined natively in C/C++ already. So what is it you're trying to do? Wait for a key to be pressed? Fine -- that's called input. So in C, use getchar() instead. In C++, how about cin.get()? All you have to do is press RETURN and your program continues.
I found that in google a long time ago and in my
previous posts I said it was bad and I wanted
to move away from it....if you are replying to me
that is... .
- Netwatcher
- Chaos Rift Junior
- Posts: 378
- Joined: Sun Jun 07, 2009 2:49 am
- Current Project: The Awesome Game (Actual title)
- Favorite Gaming Platforms: Cabbage, Ground beef
- Programming Language of Choice: C++
- Location: Rehovot, Israel
Re: Pause Function
Is think you have to check wether you get an input from the keyboard, and that's it...
so just check if WM_KEYDOWN is true...
for more info http://msdn.microsoft.com/en-us/library/ms912654.aspx (on WM_KEYDOWN)
so just check if WM_KEYDOWN is true...
for more info http://msdn.microsoft.com/en-us/library/ms912654.aspx (on WM_KEYDOWN)
"Programmers are the Gods of their tiny worlds. They create something out of nothing. In their command-line universe, they say when it’s sunny and when it rains. And the tiny universe complies."
-Derek Powazek, http://powazek.com/posts/1655
blip.fm DJ profile - http://blip.fm/Noobay
current code project http://sourceforge.net/projects/vulcanengine/
-Derek Powazek, http://powazek.com/posts/1655
blip.fm DJ profile - http://blip.fm/Noobay
current code project http://sourceforge.net/projects/vulcanengine/
Re: Pause Function
You just wait cyrax, your time is coming, did you get banned . so you made a new account, time for IP ban loser... You don't know how to change your IP... I could get around that, but you're such a noob you wouldn't be able to, you'd probably go to your grandmas house and make a new account!
- zodiac976
- Chaos Rift Regular
- Posts: 156
- Joined: Thu Jun 18, 2009 10:03 am
- Current Project: Booklet & Text RPG
- Favorite Gaming Platforms: PC, PS3, PSP
- Programming Language of Choice: C++
- Location: AL
- Contact:
Re: Pause Function
Who is this guy he sounds like an immature kid not getting
his way.
his way.