Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 16 Oct 2002 19:07:01 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: starting a cygwin app from a Windows Service Message-ID: <20021016230701.GB25022@redhat.com> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <9532AC3F9163F4458A2A212C4CF8A2EC2C9508 AT liilmtst03 DOT mailtask DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i On Thu, Oct 17, 2002 at 12:09:35AM +0200, Dan Vasaru wrote: >Mark, > >As Chris suggested, if you want consistent behaviour under cygwin, always >open text files in text mode (O_TEXT or "rt"). >Even better, wrt portability to Unix platforms, is to: > >1. open the file in binary mode >2. be prepared to accept both CRLF- and LF-style text files (i.e. strip the >CR yourself) > >This way, your software will always "behave" when encountering a Windows >file while running on a Unix platform. I don't know. I think it would be far simpler to have something like: #ifdef __CYGWIN__ # define READTEXT "rt" #else # define READTEXT "r" #endif . . . FILE fp = fopen ("foo", READTEXT); rather than reinvent the CRLF handling that already exists in the cygwin DLL. Another option is to link with /usr/lib/automode.o or /usr/lib/textmode.o . cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/