I having trouble with a QNX4 application which uses the term…() functions
and then tries to return to normal I/O mode, with printf()'s as output.
If I do the following code sequence the printf() output gets delayed until
the program exits.
term_load();
term_restore();
printf(“Hi\n”);
sleep(5);
exit(0);
Adding a “fflush(stdout);” after the printf() fixes the situation, (ie: the
“Hi” appears before the sleep() executes).
I don’t want to add fflush’s after all printf’s, what can be done in the
program to return it to normal I/O after “term” functions have been used??
–
Regards…Rod.
Rod Doré (Mgr. Engineering) rod@connecttech.com Voice: 1-800-426-8979
Connect Tech Inc. www.connecttech.com
Rod Dore <rod@connecttech.com> wrote:
I having trouble with a QNX4 application which uses the term…() functions
and then tries to return to normal I/O mode, with printf()'s as output.
If I do the following code sequence the printf() output gets delayed until
the program exits.
term_load();
term_restore();
printf(“Hi\n”);
sleep(5);
exit(0);
Adding a “fflush(stdout);” after the printf() fixes the situation, (ie: the
“Hi” appears before the sleep() executes).
Hm…maybe something munged the output type for stdio, try a
setvbuf() before the printf and see what happens. (Check docs
for parameters – you want the L flag, IO_LBF or something like
that.)
-David
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.
That suggestion fixed it…I placed this line of code after the
term_restore() call…
setvbuf(stdout, NULL, _IOLBF, 0);
…Thanks.
“David Gibbs” <dagibbs@qnx.com> wrote in message
news:b76n2u$2gk$1@nntp.qnx.com…
Rod Dore <> rod@connecttech.com> > wrote:
I having trouble with a QNX4 application which uses the term…()
functions
and then tries to return to normal I/O mode, with printf()'s as output.
If I do the following code sequence the printf() output gets delayed
until
the program exits.
term_load();
term_restore();
printf(“Hi\n”);
sleep(5);
exit(0);
Adding a “fflush(stdout);” after the printf() fixes the situation, (ie:
the
“Hi” appears before the sleep() executes).
Hm…maybe something munged the output type for stdio, try a
setvbuf() before the printf and see what happens. (Check docs
for parameters – you want the L flag, IO_LBF or something like
that.)
-David
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.