LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   tcsetattr() TCSANOW vs. TCSETA (https://www.linuxquestions.org/questions/programming-9/tcsetattr-tcsanow-vs-tcseta-323832/)

GarroteYou 05-15-2005 07:53 PM

tcsetattr() TCSANOW vs. TCSETA
 
Hello,

I'm using the tcsetattr() function to change various console attributes, and I've seen code that uses both the TCSANOW vs. TCSETA options as the second parameter to the function. I'm trying to determine the difference between the two. It would seem as if they are very similar, but I can't seem to find any solid documentation which defines the differences between the two.

Thanks in advance

~Dave

itsme86 05-16-2005 09:45 AM

According to the man page, only these values are valid for the second parameter:
Quote:

TCSANOW
the change occurs immediately.

TCSADRAIN
the change occurs after all output written to fd
has been transmitted. This function should be used
when changing parameters that affect output.

TCSAFLUSH
the change occurs after all output written to the
object referred by fd has been transmitted, and all
input that has been received but not read will be
discarded before the change is made.
And I also found this in /usr/include/term.h:
Code:

/* Add definitions to make termio look like termios.
 * But ifdef it, since there are some implementations
 * that try to do this for us in a fake <termio.h>.
 */
#ifndef TCSANOW
#define TCSANOW TCSETA
#endif
#ifndef TCSADRAIN
#define TCSADRAIN TCSETAW
#endif
#ifndef TCSAFLUSH
#define TCSAFLUSH TCSETAF
#endif

It looks like TCSANOW and TCSETA are exactly the same. I'd probably stick with TCSANOW though since it's actually in the man page.


All times are GMT -5. The time now is 05:11 PM.