Hello,
I would like to write a C++ programme on Ubuntu,
which reacts immediately to the input without pressing enter.
(-> I cannot use the header #include <conio.h> due to the reason that I am working on an UNIX system)
For instance:
I press on my keyboard the key "a", but instead of showing "a" in the terminal,
the programme should show "p".
For the last two days, I tried to do this with the header #include <ncurses.h>.
Unfortunately, it doesn't work.
Therefore, I would like to ask for your request.
With conio.h it would be like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
int main(void)
{
char c;
c = getch();
while(true)
{
if(c=='a')
{
putch('p');
}
else
{
putch(c);
}
c = getch();
}
cin.sync();
cin.get();
}
|
How can I realise the programme without using #include <conio.h>?
With best regards
quark42