RE: [Dev-C++] How to not close output win?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Reid T. <Rei...@at...> - 2003-10-03 12:09:48
|
EX.=20
=20
#include <stdio.h>=20
#include <stdlib.h>=20
=20
static void myExit(void);=20
static void myFirstExitLocation(int myExitFlag);=20
static void mySecondExitLocation(int myExitFlag);=20
int main(void)=20
{=20
int myExitFlag;=20
myExitFlag =3D 0; /* set to 0 to exit from myFirstExitLocation */=20
/* set to 1 to exit from mySecondExitLocation */=20
/* set to anything else to exit from main */=20
myFirstExitLocation(myExitFlag);=20
mySecondExitLocation(myExitFlag);=20
=20
=20
printf("Exiting from main\n");=20
myExit();=20
return(0); /* never reachable */=20
}=20
=20
void myExit(void)=20
{=20
system("PAUSE");=20
exit(0);=20
}=20
void myFirstExitLocation(int myExitFlag)=20
{=20
printf("In myFirstExitLocation\n");=20
if (myExitFlag =3D=3D 0)=20
{=20
printf("Exiting In myFirstExitLocation\n");=20
myExit();=20
}=20
}=20
void mySecondtExitLocation(int myExitFlag)=20
{=20
printf("In mySecondExitLocation\n");=20
if (myExitFlag =3D=3D 1)=20
{=20
printf("Exiting In mySecondExitLocation\n");=20
myExit();=20
}=20
}=20
=20
=20
reid=20
-----Original Message-----=20
From: Reid Thompson=20
Sent: Friday, October 03, 2003 7:45 AM=20
To: Natalie Bryant; ber...@ce...=20
Cc: devc++=20
Subject: RE: [Dev-C++] How to not close output win?=20
Create an exit function that has the system pause in it. Then,
everywhere you wish to exit, call the exit function. Only have to have
it in one place.
=20
reid=20
-----Original Message-----=20
From: Natalie Bryant [mailto:nap...@lo...]=20
Sent: Friday, October 03, 2003 7:03 AM=20
To: ber...@ce...=20
Cc: devc++=20
Subject: Re: [Dev-C++] How to not close output win?=20
Thankyou Massimo,=20
=20
I'll bear that in mind for later when I need it.=20
=20
Kind regards=20
=20
Natalie=20
----- Original Message -----=20
From: HYPERLINK "mailto:kb...@ce..."Massimo Bertozzi=20
To: HYPERLINK "mailto:nap...@lo..."Natalie Bryant=20
Cc: HYPERLINK "mailto:dev...@li..."devc++=20
Sent: Friday, October 03, 2003 11:55 AM=20
Subject: Re: [Dev-C++] How to not close output win?=20
On Fri, Oct 03, 2003 at 11:39:33AM +0100, Natalie Bryant <HYPERLINK
"mailto:nap...@lo..."nap...@lo...>
wrote:
> Hi Neszt,=20
>=20
> Reid sent me this solution yesterday to the same problem. It instantly
made everything work properly... Shown below.=20
Yes, until you have a single exit in your program. When you have more
possibilities you have to replicate the system("pause") everywhere.=20
M.=20
--=20
Massimo Bertozzi =20
Dipartimento di Ingegneria dell'Informazione Voice: +39 0521 90
5735=20
Parco Area delle Scienze, 181A, Parma, ITALY Fax: +39 0521 90
5723=20
WWW: http://www.ce.unipr.it/people/bertozzi E-mail: HYPERLINK
"mailto:ber...@CE..."ber...@CE...=20
=20
|