Press Any Key

  • Thread starter Sprechen sie von C++
  • Start date
S

Sprechen sie von C++

In a simple program I wrote I am currently using

system('pause');

to achieve the desired pause so the the output of a console program will
work fine in Windows. The problem is that is not the most portable way of
doing anything.

What other options do I have available that will replace this in a revision
of the code.
 
S

Sprechen sie von C++

I have noticed this, so given the Linux box, the Windows box, the old Cray
etc. I guess a new function is needed with some code the identify the
various #defines.

A real nuisance is that VS 2008 #defines things that its not 100% compatible
with.

Is pause relatively universal?
 
J

James Kanze

In a simple program I wrote I am currently using

to achieve the desired pause so the the output of a console
program will work fine in Windows. The problem is that is not
the most portable way of doing anything.

I've never needed it in Windows, either. And I've written far
more console programs than others in Windows.
What other options do I have available that will replace this
in a revision of the code.

What do you want to achieve? If you just want to wait for user
input, std::cin.get() works fine.
 
S

Sprechen sie von C++

Thanks, that might just be more what I need. The other way works no problem
but I was forgetful of the STL ideas.
 
V

Vladimir Jovic

Sprechen said:
In a simple program I wrote I am currently using

system('pause');

to achieve the desired pause so the the output of a console program will
work fine in Windows. The problem is that is not the most portable way
of doing anything.

What other options do I have available that will replace this in a
revision of the code.

http://linux.die.net/man/3/sleep

Not sure if it works on windows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top