473,241 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

how stop console application in Borland C++

how stop console application in Borland C++ that stay on top more time?

when I start console aplication, console stay on top 1 seconds only..
Jul 22 '05 #1
11 10423

"PHP2" <gp@nospm.hr> wrote in message news:bp**********@ls219.htnet.hr...
how stop console application in Borland C++ that stay on top more time?

when I start console aplication, console stay on top 1 seconds only..


If I understand you correctly then

system("pause");

may be what you are after. This will make the 'console' appear until the
user presses a key. I think this works only in windows which I am guessing
is what you are after.
If this is not what you require, then perhaps a better description is
required.
Allan
Jul 22 '05 #2
I am try :

// my first program in C++

#include <iostream.h>

int main ()
{
cout << "Hello World!";
return 0;
system("pause");
}
but this was NOT pause command prompt window in win2000

"Allan Bruce" <al*****@TAKEAWAYf2s.com> wrote in message
news:bp**********@news.freedom2surf.net...

"PHP2" <gp@nospm.hr> wrote in message news:bp**********@ls219.htnet.hr...
how stop console application in Borland C++ that stay on top more time?

when I start console aplication, console stay on top 1 seconds only..
If I understand you correctly then

system("pause");

may be what you are after. This will make the 'console' appear until the
user presses a key. I think this works only in windows which I am

guessing is what you are after.
If this is not what you require, then perhaps a better description is
required.
Allan

Jul 22 '05 #3

"PHP2" <gp@nospm.hr> wrote in message news:bp**********@ls219.htnet.hr...
I am try :

// my first program in C++

#include <iostream.h>

int main ()
{
cout << "Hello World!";
return 0;
system("pause");
}
but this was NOT pause command prompt window in win2000


you need to place the
system("pause");
before the
return 0;
I will leave it up to you to research it as to why this is the case.
Allan
Jul 22 '05 #4
thanks!
:-))

"Allan Bruce" <al*****@TAKEAWAYf2s.com> wrote in message
news:bp**********@news.freedom2surf.net...

"PHP2" <gp@nospm.hr> wrote in message news:bp**********@ls219.htnet.hr...
I am try :

// my first program in C++

#include <iostream.h>

int main ()
{
cout << "Hello World!";
return 0;
system("pause");
}
but this was NOT pause command prompt window in win2000


you need to place the
system("pause");
before the
return 0;
I will leave it up to you to research it as to why this is the case.
Allan

Jul 22 '05 #5
PHP2 wrote:
I am try :

// my first program in C++

#include <iostream.h>
#include <iostream> // this is the standard header, not iostream.h
#include <cstdlib> // declares system()
int main ()
{
cout << "Hello World!";
// cout lives in the std namespace
std::cout << "Hello World!";
return 0;
system("pause");
// system() lives in the std namespace
std::system("pause");
return 0;
}


--
Dirk

(PGP keyID: 0x448BC5DD - http://www.gnupg.org - http://www.pgp.com)

..oO° For sale: hand scanner. Used twice. °Oo.

Jul 22 '05 #6
Alternatively, why not use getch() ?

#include <iostream.h>
#include <conio> // for getch()

int main ()
{
cout << "Hello World!";
getch();
return 0;
}

getch() causes the program to freeze until you press any key on the keyboard.
I've always found it a great testing tool especially within loops but do remove
them once you're satisfied with the program.

JB
Jul 22 '05 #7
jbruno4000 wrote:
Alternatively, why not use getch() ?

#include <iostream.h>
#include <conio> // for getch()

int main ()
{
cout << "Hello World!";
getch();
return 0;
}

getch() causes the program to freeze until you press any key on the keyboard.
I've always found it a great testing tool especially within loops but do remove
them once you're satisfied with the program.

JB


Alternatively, why not something more portable:
#include <iostream>
using namespace std;

int main(void)
{
cout << "Did you read this?\n";
cin.ignore(100000, '\n'); // Wait for the Enter key
return 0;
}
--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #8
Why does it need to be portable? It's a temporary measure. Once the application
is completed, the pause statements get removed!
Jul 22 '05 #9
i see what you meant by portable, no need to #include another header. It's a
better way for sure!
Jul 22 '05 #10
"PHP2" <gp@nospm.hr> writes:
I am try :

// my first program in C++

#include <iostream.h>

int main ()
{
cout << "Hello World!";
return 0;
system("pause");
}
but this was NOT pause command prompt window in win2000


Perhaps you should place the system("pause") *before* return 0 :-)

HTH & kind regards
frank

--
Frank Schmitt
4SC AG phone: +49 89 700763-0
e-mail: frankNO DOT SPAMschmitt AT 4sc DOT com
Jul 22 '05 #11
"Allan Bruce" <al*****@TAKEAWAYf2s.com> wrote in message news:<bp**********@news.freedom2surf.net>...
"PHP2" <gp@nospm.hr> wrote in message news:bp**********@ls219.htnet.hr...
how stop console application in Borland C++ that stay on top more time?

when I start console aplication, console stay on top 1 seconds only..


If I understand you correctly then

system("pause");

may be what you are after. This will make the 'console' appear until the
user presses a key. I think this works only in windows which I am guessing
is what you are after.


Another alternative is to use
cin.get();

It's a little faster to type, and portable...
Jul 22 '05 #12

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

Similar topics

19
by: Dave | last post by:
Hi, I have done some research, trying to Clear The Screen in java code. The first option was the obv: system.out.print("\n\n\n\n\n\n\n\n\n\n\n\n"); then i heard about this method:...
1
by: Jim Heavey | last post by:
I am wanting to stop my console application and see the information which has been written to the console at a certain point in my program. I have seen people do some sort of keyboard prompt when...
7
by: Terry Olsen | last post by:
I've used the following suggestion from one of the MVP's here: 'Add a reference to 'System.Windows.Forms.dll', import the ''System.Windows.Forms' namespace, and call 'Application.Run' at the end of...
6
by: M Craig | last post by:
I'm trying to write a custom installation engine to plug into our existing build system. Some things I'm trying to do are, Create/Delete/Start/Stop Application Pools, Web Sites, and Virtual...
5
by: darthghandi | last post by:
I've created a class to listen to all interfaces and do a BeginAccept(). Once it gets a connection, it passes the connected socket off and stores it in a List. Next, it continues to listen for...
7
by: Marc Bartsch | last post by:
Hi, I have a background worker in my C# app that makes a synchronous HttpWebRequest.GetResponse() call. The idea is to POST a file to a server on the internet. When I call HttpWebRequest.Abort()...
3
by: Sheikko | last post by:
Sincerly is a little bit complicated to explain to you what I have in my mind, but I will try: Above all the problem is the type of data that I want to passe between these two applications. The...
0
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I have a windows application that does not stop running whenever the application exits. Could someone fill me in on what I am doing wrong? Here is the relevant code:...
1
by: kamcap | last post by:
I have referenced a COM dll (unmanagged code) in a C# console application and this DLL is referenced in C# program using Interop facility in .NET. This dll actually a dataset/table which is written...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.