0

By referencing the source in the following link : Serial_Port_Programming_How_To

I found out that there are c_cc character configurations there. After searching around the affections, I did not find the exact answer to this. I try to comment out each line of these c_cc configurations and found out the following line does affect the output.

newtio.c_cc[VEOF]     = 4;

Can anyone explain the meaning of this and possibly for the rest of these?

Thanks

2

1 Answer 1

1

As suggested, the manual page for termios is a starting point:

VEOF

(004, EOT, Ctrl-D) End-of-file character (EOF). More precisely: this character causes the pending tty buffer to be sent to the waiting user program without waiting for end-of-line. If it is the first character of the line, the read(2) in the user program returns 0, which signifies end-of-file. Recognized when ICANON is set, and then not passed as input.

In the context of the given link, 3.1. Canonical Input Processing, the OP has observed that commenting out an assignment

newtio.c_cc[VEOF]     = 4;

prevents ^D from working as expected. That, and similar assignments correspond to the settings one might use for a shell script with stty. Internally (using termios) those are set to an undefined value when assigned 0xff, but a default 0x00 is almost as good.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.