473,396 Members | 2,081 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,396 software developers and data experts.

Can't remeber...

Hi
I am probaly a newbie compared to all you first class C++ programmers so I'm asking you the question.
I remeber reading in a book somewhere a line of code you put right at the end of your file (.cpp or .h etc) that stop your program from closing until you press enter or a key like that, I can't remeber whether it was both or just enter.
So does anyone out there know that code and would be willing to share it with me?
Thankyou
Feb 21 '07 #1
6 1230
sicarie
4,677 Expert Mod 4TB
Hi
I am probaly a newbie compared to all you first class C++ programmers so I'm asking you the question.
I remeber reading in a book somewhere a line of code you put right at the end of your file (.cpp or .h etc) that stop your program from closing until you press enter or a key like that, I can't remeber whether it was both or just enter.
So does anyone out there know that code and would be willing to share it with me?
Thankyou
char a;
cin >> a;

There is another tool that can be used, but many consider it depricated and horribly unweildly.
Feb 21 '07 #2
RedSon
5,000 Expert 4TB
isn't there like a getch(); method or something?
Feb 21 '07 #3
sicarie
4,677 Expert Mod 4TB
isn't there like a getch(); method or something?
@#$%^&*(*^%$#@$%^&*!

Sorry. I hate 'getch()'. conio.h is not considered standard, and will not work on all systems. I hate getch().

That I know of there is 'system(pause)' (that's the approximate command), but that is considered unweildly and bad practice because it will perform the same function as cin in this case, but does so by making a system call to the kernel.

http://www.gidnetwork.com/b-61.html
Feb 21 '07 #4
RedSon
5,000 Expert 4TB
Ahhh oops! Maybe I should moderate myself!
Feb 21 '07 #5
sicarie
4,677 Expert Mod 4TB
Ahhh oops! Maybe I should moderate myself!
Sorry, I feel rather strongly about it. There is definitely a lot of it coming into this forum (so much that I have given up trying to get people to move away from it), and I have seen it several other places as well, but I can't run or compile it.

It's a legitimate method... as long as everyone the executable goes to has the proper conio.h.
Feb 21 '07 #6
Ganon11
3,652 Expert 2GB
I use the

Expand|Select|Wrap|Line Numbers
  1. system("PAUSE");
approach, but I'm pretty sure it's platform-dependent. Any of these methods will work, it just depends on which one you pick.
Feb 21 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: AK | last post by:
Hi all, I have a form which simulates a form collecting a person's info for a job. The form has the field's like fname, lname, address etc. The last field in the form is browse for resume and...
5
by: lawrence | last post by:
I've waited 6 weeks for an answer to my other question and still no luck, so let me rephrase the question. I know I can do this: <form method="post" action="$self"> <input type="text"...
1
by: farzad | last post by:
Hi I try to install php_ming.so in my php . I am using Redhat 8.0 php 4.2.2 apache 2.0.4. I am doing as the howto install file want me to do. as follow....
6
by: crispy | last post by:
I am trying to say if (condition) is true OR (condition) is true THEN Can I use OR or do ihave to break it down into an elseif statement? I tried OR but it does not seem to work. thanks....
3
by: PhilM | last post by:
Hi, I am looking for a database engine which: 1) runs under Windows (multiple versions) 2) Can be redistributed without additional fees as part of another product Is postgresql...
0
by: Peri | last post by:
>I can delete RCan't delete Registry.LocalMachine Thanks to Willy. I had to open RegistryKey in write mode. I forgot about this, but I was sure I was deleting from LocalMachine some time ago. I ...
3
by: rayapatilavakumar | last post by:
Hi all, i am doing one ASP.Net/C#.Net project in that i have designed one form,in that form i have 2 textboxes for username and password and one check box and one button.after entering the data into...
2
by: tvnaidu | last post by:
Why firefox doesn't remember userid and password eventhough I select checkbox "Remeber my login on this computer"?
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
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...

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.