This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: starting a cygwin app from a Windows Service


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]