| View previous topic :: View next topic |
| Author |
Message |
Itachi08 Expert Cheater
Reputation: 0
Joined: 03 Nov 2006 Posts: 101
|
Posted: Sat Jul 28, 2007 3:48 am Post subject: [Help]C/C++ |
|
|
my problem is whenever i compile a program in c or c++ i open the .exe
and lets say for example a program that outputs "Hello world"
and it opens for less than a second and it closes..
in C++ i have a solution by writing system("PAUSE"); but i just started learning C and i don't know how to fix this..
can anyone help?
_________________
|
|
| Back to top |
|
 |
DeltaFlyer Grandmaster Cheater
Reputation: 0
Joined: 22 Jul 2006 Posts: 666
|
Posted: Sat Jul 28, 2007 6:12 am Post subject: |
|
|
Call the function getch at the end.
_________________
Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for? |
|
| Back to top |
|
 |
Itachi08 Expert Cheater
Reputation: 0
Joined: 03 Nov 2006 Posts: 101
|
Posted: Sat Jul 28, 2007 7:35 am Post subject: |
|
|
k thx
_________________
Last edited by Itachi08 on Sat Jul 28, 2007 8:31 am; edited 1 time in total |
|
| Back to top |
|
 |
the_undead Expert Cheater
Reputation: 1
Joined: 12 Nov 2006 Posts: 235 Location: Johannesburg, South Africa
|
Posted: Sat Jul 28, 2007 7:41 am Post subject: |
|
|
getch()
_________________
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sat Jul 28, 2007 10:09 am Post subject: |
|
|
try
| Code: | #include <stdlib.h>
//coding
system("pause>nul"); |
not sure if its just for C++ or not
but it stops the program till u press a button, but doesnt say anything unlike
system("pause");
_________________
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sat Jul 28, 2007 10:19 am Post subject: |
|
|
don't do that, instead, do
e: ok
Last edited by appalsap on Sat Jul 28, 2007 10:58 am; edited 1 time in total |
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Sat Jul 28, 2007 10:57 am Post subject: |
|
|
| getch() is declared deprecated. Use _getch() instead of it.
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Sat Jul 28, 2007 11:54 am Post subject: |
|
|
| Code: | #include "stdio.h"
int main()
{
printf("Hello World\n");
scanf(0);
return 0;
}
|
Thats really shit and fucks up. But i cant post someting already posted can i?
|
|
| Back to top |
|
 |
DeltaFlyer Grandmaster Cheater
Reputation: 0
Joined: 22 Jul 2006 Posts: 666
|
Posted: Sat Jul 28, 2007 12:14 pm Post subject: |
|
|
You could always post getchar.
_________________
Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for? |
|
| Back to top |
|
 |
Itachi08 Expert Cheater
Reputation: 0
Joined: 03 Nov 2006 Posts: 101
|
Posted: Sat Jul 28, 2007 1:46 pm Post subject: |
|
|
I use dev c++ and when i do getch() it has error when i compile
_________________
|
|
| Back to top |
|
 |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Sat Jul 28, 2007 1:51 pm Post subject: |
|
|
you need to include conio.h
_________________
|
|
| Back to top |
|
 |
|