home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.sun.misc:3316 comp.unix.ultrix:5863 comp.unix.bsd:2746
- Newsgroups: comp.sys.sun.misc,comp.unix.ultrix,comp.unix.bsd
- Path: sparky!uunet!kithrup!sef
- From: sef@kithrup.COM (Sean Eric Fagan)
- Subject: Re: Beware of fileno()
- Organization: Kithrup Enterprises, Ltd.
- Date: Fri, 24 Jul 1992 06:23:20 GMT
- Message-ID: <1992Jul24.062320.2170@kithrup.COM>
- Keywords: sunos, ultrix, stdio, fileno, lossage
- References: <14njaeINNvk@agate.berkeley.edu>
- Lines: 15
-
- In article <14njaeINNvk@agate.berkeley.edu> stolcke@ICSI.Berkeley.EDU (Andreas Stolcke) writes:
- >This is because fileno() returns a char field in the FILE structure.
- >On systems like Sun where char is signed this results in a negative
- >integer file descriptor. To prevent lossage, one has to use
- >
- > (unsigned char)fileno(stream)
-
- Current BSD sources have the _file element as a short. Chris Torek
- anticipated your needs by several years 8-).
-
- --
- Sean Eric Fagan | "My psychiatrist says I have a messiah
- sef@kithrup.COM | complex. But I forgive him."
- -----------------+ -- Jim Carrey
- Any opinions expressed are my own, and generally unpopular with others.
-