473,722 Members | 2,161 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

system("PAUSE") for linux?

Is there something like system("PAUSE") for linux?
Nov 15 '05 #1
11 39894
In article <di**********@n ews.net.uni-c.dk>, Paminu <ja******@asd.c om> wrote:
:Is there something like system("PAUSE") for linux?

As far as this newsgroup is concerned, the exact replacement is

system("PAUSE") ;

That's because as far as this newsgroup is concerned, PAUSE has
an unidentified system-dependant function. If the functionality of
PAUSE were to be described, then a Unix or Linux newsgroup would be
able to tell you what the nearest Linux equivilent would be.
On some systems, PAUSE means "suspend CPU activity on the system until
there is an interrupt". On others, it means "suspend the active process
for 1 second". On others, it means "flush any pending output and
wait until a key is pressed and then continue (without waiting for
a newline.) On others, the newline is required. On others, it means
"print the error message associated with not finding a named program
or command". On others it means "look for an executable program
named PAUSE in the current directory and execute it, with whatever
consequences that has." Others yet it would mean "look for an
executable program named PAUSE in the currently defined list of
program locations, and execute it, with whatever condequences that has."

Possibly the most common meaning, though, is "Play a recording
of your voice telling the dog to get his paws off of the furniture."
If that's the one you were looking for, see section 93.11 of the
Linux FAQ, which discusses the various ways of getting high-fidelity
playback of His Master's Voice on various kinds of sound cards
and Midi Synthesizers.
--
All is vanity. -- Ecclesiastes
Nov 15 '05 #2
Paminu <ja******@asd.c om> writes:
Is there something like system("PAUSE") for linux?


We don't know. Try a Linux or Unix group. comp.unix.progr ammer is a
likely place to ask about this -- but first explain what
system("PAUSE") means.

But first, try reading the documentation that comes with the system.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #3
Paminu wrote:
Is there something like system("PAUSE") for linux?


This is off-topic for comp.lang.c, you should have posted to
comp.unix.progr ammer. However, I have written a clone of the MS-DOS
pause command for Linux, and I can give you a link to it here.

http://members.optushome.com.au/sbiber/pause-1.0.tar.gz

It should work on other Unix-like systems too. Extract it, change to the
directory pause-1.0, and type
make
to build, and you can type
sudo make install
to copy the executable to /usr/local/bin

--
Simon.
Nov 15 '05 #4
In article <di**********@n ews.net.uni-c.dk>, Paminu <ja******@asd.c om> wrote:


Is there something like system("PAUSE") for linux?


Linux programs generally don't do that. It makes it hard
to use your program in a pipe context, plus one usually
runs command line programs...from the command line...so by
default there's no danger of the window just disappearing
as soon as the program is done.

It's usually left to the user to pipe your program's output
through "less" or "more" if they want to pause between
screenfuls of data.
Nov 15 '05 #5
Simon Biber wrote:
Paminu wrote:
Is there something like system("PAUSE") for linux?


This is off-topic for comp.lang.c, you should have posted to
comp.unix.progr ammer. However, I have written a clone of the MS-DOS
pause command for Linux, and I can give you a link to it here.

http://members.optushome.com.au/sbiber/pause-1.0.tar.gz

It should work on other Unix-like systems too. Extract it, change to the
directory pause-1.0, and type
make
to build, and you can type
sudo make install
to copy the executable to /usr/local/bin

Ok done that but how do I use it in my source.c file??
Nov 15 '05 #6
Paminu wrote:

Is there something like system("PAUSE") for linux?


Assuming that system("PAUSE") causes a Windows box to display "press any
key to continue", and then waits for any keystroke, the answer is "no".
(Check the FAQ. I'm sure someone can give the exact section number.)

However, if you are willing to go for "press enter to continue" instead,
then you can simply printf() that message, and use a while loop waiting
for getchar() to return '\n'.

--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer .h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:Th***** ********@gmail. com>
Nov 15 '05 #7
Paminu wrote:
Simon Biber wrote:
Paminu wrote:
Is there something like system("PAUSE") for linux?


This is off-topic for comp.lang.c, you should have posted to
comp.unix.pro grammer. However, I have written a clone of the MS-DOS
pause command for Linux, and I can give you a link to it here.

http://members.optushome.com.au/sbiber/pause-1.0.tar.gz

It should work on other Unix-like systems too. Extract it, change to the
directory pause-1.0, and type
make
to build, and you can type
sudo make install
to copy the executable to /usr/local/bin


Ok done that but how do I use it in my source.c file??


If it's installed to a location that is in your PATH, then you need only
write system("pause") ; in your source code. Note that Linux is
case-sensitive. It won't work if you use uppercase "PAUSE" in your
program but the program is called lowercase "pause".

You might want to create a directory under your home directory to store
your own commands, such as ~/bin
mkdir ~/bin
cp pause ~/bin

Then, add a line to your ~/.profile file to make sure that this
directory is always added to your path:
export PATH=$PATH:$HOM E/bin

Log out and back in, and check that the directory was added to your
path. You can check your path list by typing
echo $PATH

--
Simon.
Nov 15 '05 #8
Paminu <ja******@asd.c om> writes:
Is there something like system("PAUSE") for linux?


You don't want to do that.

While it's certainly possible, you
1) Don't want to use system(3) just to pause the program: create a
pause() function. "man 3 termios" to disable line buffering, or
check out [n]curses.
2) Need to ask yourself why you need this. If you are running on a
TTY or PTY, what is the benefit?

The only use I've seen for this in Windows programs is to work around
the horrible broken terminal emulator that comes with Windows. You
won't have that problem on Linux: the emulator is not going to close
when your program terminates, so this is pointless.
Regards,
Roger

--
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
Nov 15 '05 #9
In article <87************ @hardknott.home .whinlatter.ukf sn.org>,
Roger Leigh <${*******@inva lid.whinlatter. ukfsn.org.inval id> wrote:
....
The only use I've seen for this in Windows programs is to work around
the horrible broken terminal emulator that comes with Windows.
Actually, I use the "pause" functionality (built-in in DOS/Windows; written
by me [and others] for Unix) frequently on both platforms for script
debugging.

And note, BTW, that some scripts are never (fully) debugged because the
data sources are unreliable. So, the pauses must be left in in perpetuity.
You won't have that problem on Linux: the emulator is not going to close
when your program terminates, so this is pointless.


(It is somewhat unclear to what you are really referring here, since Windows
doesn't really have an "emulator" - in the sense that Unix does. But,
leaving that aside for the moment...)

Actually, this *is* a problem under Unix, as frequent postings in the shell
group(s) attest. That is, people looking for something along the lines of:

xterm -e sh -c '...;echo "Press enter...";read x'

Nov 15 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6093
by: Danny Anderson | last post by:
Hola! I am working on a program where I am including a library that came with my numerical methods textbook. The "util.h" simply includes a large number of files. I had to change the util.h slightly to adjust path names and also take into account I am working with a case-sensitive OS. My program is below. The sticky point is that adding (#include "util.h") seems to negate the (#include <string>) statement somehow. How can I get...
4
30368
by: Kerwin Cabrera | last post by:
I am writing a console application and I would like to put a "Press any key..." message once the program is done executing. Currently, when it executes it returns to the prompt. I have tried console.read and console.readline but they both require an <Enter> key to be hit. Any suggestions Thanks -KC
34
2676
by: Frederick Gotham | last post by:
Is the domestic usage of the C "for" loop inefficient when it comes to simple incrementation? Here's a very simple program that prints out the bit-numbers in a byte. #include <stdio.h> #include <limits.h> #include <stdlib.h> int main(void) {
14
2359
by: Chen Shusheng | last post by:
CSS white here: Simply strange, I found "define" can not work with "malloc". Together my complier will say "parse error". Could anyone tell me why? ------------------------- #define MAX 10000 ....... int main(void){ .....
33
25216
by: Chen shuSheng | last post by:
I have a code: --------------------------- #include <iostream.h> #include <stdlib.h> int main() { int max=15; char line; getline(line,max); system("PAUSE");
23
4862
by: mahesh | last post by:
Hi all, I have following code that is supposed to increase the power by specified value. int main() { system("cls"); int i, exponent; double base; double new_base=0.0;
5
6490
by: CoderMarc | last post by:
Hi, I can not get the system pause to work in a simple program. Here is my program below: // i/o example #include <iostream> using namespace std; int main ()
12
1920
by: kevineller794 | last post by:
I want to make a split string function, but it's getting complicated. What I want to do is make a function with a String, BeginStr and an EndStr variable, and I want it to return it in a char array. For example: char teststr; strcpy(teststr, "test:blah;");
0
1352
by: jorgetheawesome | last post by:
Hi! I was writing a program, and for debugging, used the system("pause") command. I am running Windows XP. Its an MS-DOS app, programmed in Dev-C++. But the program, when compiled, runs differently each time, without recompiling and without changing the code. Also, system pause sometimes exits the program and sometimes runs(the differences are whether it runs normally or exits). I did get a system error-Mis called Windows function- from the...
0
8739
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4502
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.