Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss
Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

The tcflush () function on SunOS and HP-UX

7 views
Skip to first unread message

Alex Vinokur

unread,
Mar 22, 1999, 3:00:00 AM3/22/99
to

Hi,

The same program was compiled on SunOS and HP-UX 10.
The program contains the tcflush (...) function.

But the results of the running on SunOS and HP-UX 10 are different.
The program works OK on SunOS,
but it seems it isn't OK on HP-UX 10.

Does anybody know what is wrong?

Thanks in advance,
Alex


//##########################################
//##### 1. Program #########################
//##########################################

#include <string>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <termios.h>
int main(void)
{
string s1;

while (1)
{
switch (tcflush(0, TCIFLUSH))
{
case 0 :
// OK
break;

case 1 :
cout << "FATAL ERROR : "
<< (strerror (errno))
<< endl;
exit (1);
break; // unused

default :
abort ();
break; // unused
} // switch (tcflush(0, TCIFLUSH))

cout << "Enter : ";
cin >> s1;
cout << "\tValue = " << s1 << endl;
sleep (5);
}
return 0;
}

//##########################################
//##### 2. SunOS ###########################
//##########################################
Compiler -> g++ -v : gcc version egcs-2.91.57 19980901
(egcs-1.1 release)
System -> uname -a : SunOS <nodename> 5.6 Generic_105181-09
sun4m sparc SUNW,SPARCstation-5


//=== Running ====
%a.out
Enter : aaaaa // aaaaa is input data
Value = aaaaa
bbbbb // bbbbb is input data
ccccc // ccccc is input data
Enter : ddddd // ddddd is input data
Value = ddddd
cntrl-c

//=== Conclusion ====
The data, received but not read, are flushed (bbbbb, ccccc)


//##########################################
//##### 3. HP-UX ###########################
//##########################################
Compiler -> g++ -v : gcc version 2.8.1
Compiler -> aCC : HP aC++ B3910B A.01.06
HP aC++ B3910B A.01.01 Support Library
Note! The same results were obtained using both g++ and aCC.

System -> uname -a : HP-UX <nodename> B.10.20 A
9000/847 1410304272 two-user license


//=== Running ====
%a.out
Enter : aaaaa // aaaaa is input data
Value = aaaaa
bbbbb // bbbbb is input data
ccccc // ccccc is input data
Enter : Value = bbbbb // ???
Enter : Value = ccccc // ???
Enter : ddddd // ddddd is input data
Value = ddddd
cntrl-c

//=== Conclusion ====
No data are flushed.


//##########################################
//##### END of INFORMATION #################
//##########################################

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

0 new messages