This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: stat file -- cygwin vs. Windows size?
- From: Igor Pechtchanski <pechtcha at cs dot nyu dot edu>
- To: Herb Martin <HerbM at LearnQuick dot Com>
- Cc: cygwin at cygwin dot com
- Date: Fri, 24 Jun 2005 14:14:33 -0400 (EDT)
- Subject: RE: stat file -- cygwin vs. Windows size?
- References: <20206A8F2DE2@mail.learnquick.com>
- Reply-to: cygwin at cygwin dot com
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@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.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/