Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Date: Wed, 3 Jan 2001 10:15:18 -0500
From: Christopher Faylor <cgf@redhat.com>
To: cygwin@cygwin.com
Subject: Re: new function suggestion fsetmode
Message-ID: <20010103101518.C32356@redhat.com>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <011701c07598$ddd97a30$0200a8c0@lifelesswks>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.3.11i
In-Reply-To: <011701c07598$ddd97a30$0200a8c0@lifelesswks>; from robert.collins@itdomain.com.au on Thu, Jan 04, 2001 at 02:21:36AM +1100

On Thu, Jan 04, 2001 at 02:21:36AM +1100, Robert Collins wrote:
>Hi,
>    I'd like to suggest a function for working on FILE* handles
>
>int fsetmode(FILE* fhandle, int mode)
>{
>    if (fhandle)
>        return setmode(fhandle->_file, mode);
>    else
>        return EOF;
>}
>
>I wasn't sure where in cygwin to place it...  so I'll leave that up to
>the core group.  I ran across a whole bunch of fopen calls recently
>that needed to be forced into text mode..  this is how I've done it.
>
>Maybe bad things happen doing this?  I assume not.  But as the function
>needs to look into the FILE * struct's privates, I figure it should be
>part of cygwin itself.

I think it is preferable to just use 'setmode' and the 'fileno(fp)' interface.
fileno() is the accepted way for looking at the internal "_file" part of
an fd structure.

cgf

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

