www.delorie.com/archives/browse.cgi | search |
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 |
Reply-To: | Cygwin List <cygwin AT cygwin DOT com> |
Message-Id: | <6.2.1.2.0.20050624141431.06359818@pop.prospeed.net> |
Date: | Fri, 24 Jun 2005 14:19:27 -0400 |
To: | "Herb Martin" <HerbM AT LearnQuick DOT Com>, "'Cygwin List'" <cygwin AT cygwin DOT com> |
From: | Larry Hall <lh-no-personal-replies-please AT cygwin DOT com> |
Subject: | RE: stat file -- cygwin vs. Windows size? |
In-Reply-To: | <20206A8F2DE2@mail.learnquick.com> |
References: | <6 DOT 2 DOT 1 DOT 2 DOT 0 DOT 20050624134407 DOT 0635f708 AT pop DOT prospeed DOT net> <20206A8F2DE2 AT mail DOT learnquick DOT com> |
Mime-Version: | 1.0 |
At 02:08 PM 6/24/2005, you 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. If you actually believe that you want the file without cr/nl conversion during a read, then you want to open it in binary mode (fopen() with "rb" instead of "r" or open() with '| O_BINARY' appended). This *may* be the solution in this case. Since the default mode for opening files is always "text" but there is no difference in format/behavior between "text" and "binary" on UNIX/Linux, you wouldn't see an issue there. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 838 Washington Street (508) 893-9889 - FAX Holliston, MA 01746 -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |