A
aguai
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
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