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: File reading problem with -mno-cygwin


Andrew DeFaria wrote:
> 
> One question remains however and that is why would it work in Cygwin
> but not in -mno-cygwin? My theory is that opening a file with "r"
> under Cygwin is equivalent to "rb".

Andrew,

Using the -mno-cygwin option directs the code to link
against MSVCRT.DLL, so Cygwin is bypassed completely.

If you examine the Microsoft C runtime source, you'll see that
they explicitly check for a CTRL-Z as an end-of-file marker
if a file is opened in text mode.  I think this behavior, along with
the LF to CRLF conversions, is an extension that is done by
Microsoft if you're in text mode.  

I don't believe the Cygwin runtime treats CTRL-Z as a special case,
which explains the difference.

The CTRL-Z as EOF was a leftover from CP/M, but got propgated
into MSDOS/Windows.


Joe


--
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]