|
From: Ioannis V. <no...@ho...> - 2002-04-20 17:47:47
|
Yes, the pause argument is system depedent, but the system() function
can be found to any system. You simply change "pause" to the correct
command of any system. I would do the following:
// system extension encapsulated under a portable interface
void pause()
{
system("pause");
// or sleep() or whatever
}
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
<http://www.noicys.cjb.net/>
* Alternative URL: http://run.to/noicys
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Bob
Wilson
Sent: Thursday, April 18, 2002 4:08 PM
To: Dev-C++ User Mailing List
Subject: Re: [Dev-C++] enum
I've been think about this, and isn't the call to system("pause"); a
windows specific call and as such would not be portable to UNIX or any
other operating system?
Regards,
Bob
A more ANSI C++ compliant code would be:
#include <iostream>
#include <cstdlib>
int main ()
{
using std::cout;
using std::endl;
using std::system;
enum {Dog,Cat,Horse,Pig};
int i;
for (i = Dog; i <= Pig; i++)
cout << "i = " << i << endl;
system("pause");
return 0;
}
or check the comments i have placed in your code.
Ioannis
|