Hi,
Sorry if my title does not make sense. I’m fairly new to all this and just took over some legacy code.
We have a QNX machine, which has a serial port on it. Instead of using the QNX terminal locally, we:
- use a serial cable to connect the serial port from QNX to a Windows machine.
- Launch Hyperterminal on the Windows machine.
- On QNX, in terminal window, type in the command "on on -t /dev/ser1 sh (I was told this command is what allows Windows terminal to act like QNX terminal. However I couldn’t find any documentation on it)
- Start Hyperterminal on windows machine.
Now, on Hyperterminal, the following settings are OFF: a) echo typed characters locally b) Send line ends with line feeds.
With the following setup, hyperterminal is able to like QNX’s terminal. I can type in various commands like “cd”, “ls”…etc. Even though the two settings mentioned above are OFF, things work and I can see what I typed.
Now I wrote an application that resides on QNX. It is extremely simple:
int main( int argc, char *argv[] )
{
string cmd;
cout << "Please enter command: \n";
getline (cin, cmd);
cout << "The command you entered is " << cmd << "\n";
return 0;
}
When running this app on QNX terminal, it works fine. But when running this app on Hyperterminal, not so much. As soon as I start the app, anything I type locally is NOT shown. And hitting Enter does not make whatever I typed in read. Instead, I have to turn ON the “a) echo typed characters locally b) Send line ends with line feeds” options.
However, leaving those two options on, if I exit my program and go back to normal shell on Hyperterminal, anything I type is now echoed twice. e.g “llss” instead of “ls”.
Can someone please help me? i just don’t understand why those two options behave differently in normal shell vs my own app.
We also have other legacy codes that use the “curses.h” library to do input/output instead (mvprintw,wgetnstr) . Those seem to work fine. But I’d really like to get away from that and use cin/cout instead.
Thanks!!