POSIX FILE streams opened for update need either a fflush() or a file positioning function when switching from writing to reading, and a file positioning function when switching from reading to writing.
The Newlib C library as used in Cygwin fails with perror() reporting "Illegal seek" when fseek(f, 0, SEEK_CUR) is applied to a serial device (/dev/ttySx). The fseek(f, 0, SEEK_CUR) is my attempt at a null file positioning function between reading and writing to the device. Is this a bug in Newlib? If not, is there a POSIX-sanctioned file positioning function that works without fail on serial devices? If not, does that mean that POSIX requires separate streams for input and output to a serial device? - or - Can the error be safely ignored? (I think this is the right answer).