termios Q (tcsetattr() when using stdio)

Eric Norum eric.norum at usask.ca
Mon Aug 19 21:17:49 UTC 2002


On Monday, August 19, 2002, at 02:43 PM, Paul Evans wrote:

> Hi All,
>  
> After converting by BSP to termios (mainly for application
> portability), I now can't figure out what the portable way of
> doing a tcsetattr() is if I'm using libc stdio. Or more
> specifically can I get a "int " file handle from a "FILE *"
> stream pointer?
>  
> I guessing the answer is to open the file twice,
> as a stream and using libio? Or could I
> open/tcsetsttr/close then go ahead and
> use streams knowing that the termios state
> would stay intact? (Is this portable?)
>  
> And Yes I know I might look inside the FILE
> structure itself, but then the portability gods might
> strike me down. I'd rather skip fprintf in leu of
> snprintf and write() the buffer.
>

The portability gods will only make mild rumblings about using the 
POSIX-standard (as opposed to an ANSI C-standard)
int fileno(FILE *stream);
which returns the underlying file descriptor for the stream.

--
Eric Norum <eric.norum at usask.ca>
Department of Electrical Engineering
University of Saskatchewan
Saskatoon, Canada.
Phone: (306) 966-5394   FAX:   (306) 966-5407
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2101 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20020819/5aa8e12e/attachment-0001.bin>


More information about the users mailing list