Momentics Console view

This works as expected in a terminal window:

int CharReady()
{
int n;

if ( ioctl(0, FIONREAD, &n) == -1 ) {
return -1;
} else {
return n;
}
}

int main()
{
while ( CharReady() != 2 ) {
printf(“type 2 characters to stop this printing…\n”);
sleep(1);
}

// code here to flush buffers
}

… but doesn’t “respond” to characters typed in a Console view. One hint:
in a terminal window, the characters typed are not echoed, but they are
echoed in a Console view. Would you happen to know how to get this to work
as desired in a Console view? Thanks.

– Celia

Celia <celiaonline@attbi.com> wrote:

This works as expected in a terminal window:

The console view (under 6.2.1B and earlier) is not a terminal device.
It does not do character-by-character IO, but does line-oriented IO.
And, it may not even handle this ioctl.
What does CharReady() give after you hit enter on the console view?

… but doesn’t “respond” to characters typed in a Console view. One hint:
in a terminal window, the characters typed are not echoed, but they are
echoed in a Console view. Would you happen to know how to get this to work
as desired in a Console view? Thanks.

It does not (currently) support this level of output. The best I can
suggest for doing what you seem to want – that is, to debug a program
that also does more than the simplest level of terminal I/O would be
to run the program in a telnet session (to get a real terminal), then
use the IDE’s “attach to running process” ability to bring that program
into the debugger.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.