473,387 Members | 1,542 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,387 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 10439

"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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.