473,513 Members | 2,391 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C++: Unbuffered and unechoed input (ANSI compliant please)

11 New Member
I am looking to take unbuffered, unechoed input from the user.
The idea is to print "Press any key to continue" and allow the user to do just that, without having to press enter, and without having to see their character input displayed on screen.

I know I can do this with MS compilers by including conio.h, and calling getch().
However, I am looking for something that is part of the C standard library. I've searched all over, but have not found any info on this.

Can anyone help? Thanks in advance.
Mar 15 '08 #1
4 2606
Banfa
9,065 Recognized Expert Moderator Expert
I know I can do this with MS compilers by including conio.h, and calling getch().
However, I am looking for something that is part of the C standard library. I've searched all over, but have not found any info on this.
That is because there is no ANSI way to do this, all ANSI functions echo the data the receive.
Mar 15 '08 #2
oler1s
671 Recognized Expert Contributor
Actually, it's part of the default console behavior that input gets echoed. The standard libraries do not explicitly echo the input. The console does.

So if you want to robustly prevent that behavior, you need to look at the Windows Console Functions. They are part of the Windows API, so a search on MSDN should prove fruitful.

Or you could try and achieve it with a bunch of I/O hacks, but it's up to you.
Mar 15 '08 #3
Banfa
9,065 Recognized Expert Moderator Expert
Actually, it's part of the default console behavior that input gets echoed. The standard libraries do not explicitly echo the input. The console does.

So if you want to robustly prevent that behavior, you need to look at the Windows Console Functions. They are part of the Windows API, so a search on MSDN should prove fruitful.
Good point however it leads to the same conclusion, which is that there is no ANSI compliant why to do it.
Mar 15 '08 #4
yomama
11 New Member
...there is no ANSI compliant why to do it.
That's too bad. Thanks.
Mar 16 '08 #5

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

Similar topics

1
2870
by: | last post by:
Is this even possible? I've found some references to specific "unbuffered" type methods that exist in older incarnations of basic_streambuf but not in newer ones. Info please. :P
100
6824
by: Roose | last post by:
Just to make a tangential point here, in case anyone new to C doesn't understand what all these flame wars are about. Shorthand title: "My boss would fire me if I wrote 100% ANSI C code" We...
5
1685
by: RK | last post by:
I need to compile a library of C code with pre-ANSI C functions using MS ..NET 2003. The functions are declared something like this: int myFunction(p) double p; { int x; code here... return...
1
1978
by: Ed Smith | last post by:
The Postgres INTERVAL literal is not compliant with the ANSI 2003 SQL Spec. Here's the Postgres way: # select INTERVAL '45 DAY'; interval ---------- 45 days (1 row) The spec. says
4
4153
by: pank7 | last post by:
hi everyone, I have a program here to test the file IO(actually output) with buffer turned on and off. What I want to see is that there will be obvious differece in time. Here I have an input...
1
10965
by: ehchn1 | last post by:
Hi, Just curious. Would you use ANSI style table joining or the 'old fashion' table joining; especially if performance is the main concern? What I meant is illustrated below: ANSI Style...
7
6145
by: Markus Mayer | last post by:
Hi folks. I'm somewhat new to *nix programming and just ran into a problem. I have to take user input from the terminal but like to constrain that to some rules given, i.e. "numbers only" or...
3
179
by: Jack | last post by:
Hi I am just trying to get a feel for what oracle SQL syntax there is that would not be covered at all in anyway from a functionality perspective in the standard ANSI SQL.. Any input is...
4
5425
by: Jules | last post by:
I am trying to understand the behavior of a short program. Hopefully someone can tell me what's going on. The program I wrote is: #include <stdio.h> main() { char c; while(1)
0
7171
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...
1
7111
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
5692
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5095
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4751
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...
0
3240
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...
0
3228
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
461
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.