fdopen() in newlib/rtems

Joel Sherrill joel.sherrill@OARcorp.com
Wed Nov 22 06:58:00 GMT 2000

I have cc'ed the newlib list for more feedback.

Technically this is POSIX and linux has it wrapped in a 
"ifdef __USE_POSIX".  

My inclination is to say that newlib needs a similar mechanism.

Jake Janovetz wrote:
> Joel,
>     I've been using fdopen() in TCP/IP programs for RTEMS for a
> while.  I create a socket, etc, etc, then call fdopen() on that
> socket because some of the fprintf/fscanf routines are nice to
> use.
>     Recently, I've noticed that fdopen() is not defined in the
> include files causing a warning when compiling.  No big deal, the
> code works as planned.  I looked in /include/stdio.h today and
> noticed the following:
> #ifndef __STRICT_ANSI__
> #ifndef _REENT_ONLY
> FILE *  _EXFUN(fdopen, (int, const char *));
> #endif
> int     _EXFUN(fileno, (FILE *));
> int     _EXFUN(getw, (FILE *));
> int     _EXFUN(pclose, (FILE *));
> FILE *  _EXFUN(popen, (const char *, const char *));
> int     _EXFUN(putw, (int, FILE *));
> void    _EXFUN(setbuffer, (FILE *, char *, int));
> int     _EXFUN(setlinebuf, (FILE *));
> #endif
>    Now, it appears that fdopen() is not defined because __STRICT_ANSI__
> is defined.  Can you explain this to me?  I'm wondering if I should
> not be using fdopen() or if, perhaps, there is something else I should
> set somewhere to make the warning go away.
>    Warnings are typically significant -- they often seem to be the
> cause of many 'untraceable' bugs later on, so I like to clear them
> up.  Any ideas?
>     Jake

Joel Sherrill, Ph.D.             Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985

More information about the Newlib mailing list