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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf
Of Madsen, Mark
Sent: Wednesday, October 16, 2002 11:21 PM
To: [EMAIL PROTECTED]
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/

Reply via email to