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 From: "Dan Vasaru" To: "Madsen, Mark" , Subject: RE: starting a CYGWIN app from a Windows Service Date: Thu, 17 Oct 2002 00:09:35 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal In-Reply-To: <9532AC3F9163F4458A2A212C4CF8A2EC2C9508@liilmtst03.mailtask.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal 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. Dan PS. To explain the behaviour you're seeing you have to check 4 places: value of the CYGWIN environment variable when running as a service value of the CYGWIN environment variable when running as yourself system mount types user mount types There's probably a difference in the mount mode or CYGWIN variable between the 2 cases. Dan -----Original Message----- From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com]On Behalf Of Madsen, Mark Sent: Wednesday, October 16, 2002 11:21 PM To: cygwin AT cygwin DOT com Subject: starting a CYGWIN app from a Windows Service When I run an application that uses the cygwin1.dll from either a Windows Service and then from the command line I get different results when trying to read a text file. As a Windows Service: I use fopen and fgets to read a DOS text file and the CR/LF combinations are handled properly. Meaning that I only see the single LF. Running from a DOS command line: Using the exact same executable image as above, both characters are in the buffer. What I know: Both instances use the very same DLL image. (I deleted it and both instances complain about the DLL missing.) Both instances are reading the exact same file, not two different copies. I tried working with the CYGWIN environment variable with no effect on the outcome. Any help would be greatly appreciated. Thanks, Mark -- 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/ -- 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/