pause? where art thou?

ok, im somewhat of an advanced programmer for the windows-side of C/C++, and the system command to pause the console is 'system("pause");'.... i just recently transfered over to Slackware 3.3 (yes, its old, but i <3 text), and pause is not the command for pausing the command line. is there any way to do this is *nix where the console pauses until the user hits anykey .... plz dont send my messages saying use cin>> or cin.getline() because thats not what im looking for... i want something similar to windows .com PAUSE.

Thnx

system ("read somevar < /dev/tty");

Although fgetc() seems like a choice....

Not unless you specifically set stdin to unbuffered...

How about:

void pause()
{
  system("read -n 1 -p \"Press Any Key To Continue\" < /dev/tty");
  printf("\b \n");
  fflush(stdout);
}

Granted, launching a whole new process isn't the most efficient way to do this, but you never cared about that before, so if you're looking for a quick and simple solution this will work. It will wait for one and only one keyboard hit, unlike jim's similar solution, which waits for the enter key.

ahh thank you much. im just going to keep it in that form and just call from the function when needed and use it as a global function. oh btw Corona is the best beer ever invented.

Pe@cE