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

how to ignore the [enter] key?

hi Im trying to do is something should be simple:
I wish to ignore the [enter] key....'\n'
my test is Like this

/*di.cpp*/
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(void)
{
setvbuf(stdin, NULL, _IONBF, 0);
while ( cin.peek()!='\n'){cout.put(cin.get())<<endl;}
return 0;

}

then I try
aguai@home:~/cpp$ ./a.out
please dont...
p
l
e
a
s
e

d
o
n
t
..
..
..

but what i hope is like
aguai@home:~/cpp$ ./a.out
p
l
e
a
s
e

d
o
n
t
..
..
..
<push enter and exit....>

is that possible to be done with a ansi C/C++ function?
thanx

Apr 22 '07 #1
1 3859
On Apr 22, 5:15 pm, aguai <henac...@gmail.comwrote:
hi Im trying to do is something should be simple:
I wish to ignore the [enter] key....'\n'
my test is Like this

/*di.cpp*/
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(void)
{
setvbuf(stdin, NULL, _IONBF, 0);
while ( cin.peek()!='\n'){cout.put(cin.get())<<endl;}
return 0;

}

then I try
aguai@home:~/cpp$ ./a.out
please dont...
p
l
e
a
s
e

d
o
n
t
.
.
.

but what i hope is like
aguai@home:~/cpp$ ./a.out
p
l
e
a
s
e

d
o
n
t
.
.
.
<push enter and exit....>

is that possible to be done with a ansi C/C++ function?
thanx
(Deleted follow-ups)

I believe you are searching for 'noecho' which is in curses.h

Apr 22 '07 #2

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

Similar topics

6
by: Rob Meade | last post by:
Lo all, I was just running through some code I was writing for a site and when it came to the 'exact phrase' search type I wasn't sure whether that should run through and ignore the words in the...
1
by: Thomas Bartkus | last post by:
The meaning of REPLACE INTO is clear to me. IF the new record presents new key values, then it is inserted as a new record. IF the new record has key values that match a pre-existing record, then...
9
by: Newcomer | last post by:
Hi, I added a string property for my winforms control. This string property can take multiple lines of text by using "\r\n". For example, "Hello\r\nWorld" SHOULD prints: Hello World The...
1
by: Lars Netzel | last post by:
I really need to stop users from reposting the form with Enter or Return keys. It bypasses so many onClick validations that nothign works if they use Enter. I must force the user to CLICK on the...
2
by: bretth | last post by:
In a VB.Net Windows Forms application, I have a user control that handles mouse events. Another section of code programmatically adds a label to the control. I would like label to ignore all...
2
by: Shuga | last post by:
I did notice the the compiler of Borland C++ 5.02, does ignore some statements, not on one program, They are two of them. I wondered why? One was an output printf statement used to enter a data...
8
by: sixdeuce62 | last post by:
Hello, I am using Access 2002. I have read through 20 plus posts on here and I am still having trouble. My table consists of the following fields: Date Client ID
2
by: CZahrobsky | last post by:
I've written a macro to remove the annoying error flags (with a green triangle in the corner and an exclamation point with a drop-down when you enter the cell) in Excel spreadsheets that have a...
9
Haitashi
by: Haitashi | last post by:
<cfif (Attributes.icq NEQ "") AND IsNumeric (Attributes.icq) AND IsValid("integer", Attributes.icq)> <cfset Variables.oStudentProfile.icq = Attributes.icq /> <cfelse> <cfset temp =...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.