On Apr 22, 5:15 pm, aguai <henac...@gmail.com> wrote:
> 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
|