delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/06/24/14:14:46

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Fri, 24 Jun 2005 14:14:33 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Herb Martin <HerbM AT LearnQuick DOT Com>
cc: cygwin AT cygwin DOT com
Subject: RE: stat file -- cygwin vs. Windows size?
In-Reply-To: <20206A8F2DE2@mail.learnquick.com>
Message-ID: <Pine.GSO.4.61.0506241413020.5118@slinky.cs.nyu.edu>
References: <20206A8F2DE2 AT mail DOT learnquick DOT com>
MIME-Version: 1.0

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/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019