On Fri, 24 Jun 2005, Herb Martin wrote:

> > >My suspicion is that stat is counting cr-lf as two characters but the
> > >input routines are treating these as one.
> > >
> > >If the file has about 20 lines, then that's 20 missing characters???
> >
> > Yes, this is right.  And yes, this could be the cause of the
> > situation you're noticing.
>
> Is there a standard Cygwin 'idiom' or function for dealing with this
> mismatch, or should I just re-invent the wheel.

Sure -- just force binary mode on the file (i.e., open it using O_BINARY
for the open() call, or the "rb" mode for the fopen() call).  The mount
type only applies if the mode is unspecified.

> Seems like I read (skimmed) something related to this in the Cygwin
> manual, probably near the back in the programming introduction....
>
> I know I picked up the concept somewhere (somewhere recent that is, as I
> have dealt with this across at least five different OS conventions but
> not recently and specifically on Cygwin.)

HTH,
        Igor
-- 
                                http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_                [EMAIL PROTECTED]
ZZZzz /,`.-'`'    -.  ;-;;,_            [EMAIL PROTECTED]
     |,4-  ) )-,_. ,\ (  `'-'           Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL     a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to