delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/06/15/09:26:06

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <19990615133113.6413.rocketmail@web116.yahoomail.com>
Date: Tue, 15 Jun 1999 06:31:13 -0700 (PDT)
From: Earnie Boyd <earnie_boyd AT yahoo DOT com>
Reply-To: earnie_boyd AT yahoo DOT com
Subject: Re: binary/text files
To: Aldo Mazzilli <aldo DOT mazzilli AT inria DOT fr>, cygwin AT sourceware DOT cygnus DOT com
Cc: Aldo DOT Mazzilli AT inrialpes DOT fr
MIME-Version: 1.0

--- Aldo Mazzilli <aldo DOT mazzilli AT inria DOT fr> wrote:
> Hello there,
> 
> can someone tell me how CYGWIN32 handles text and binary files ??
> 
> Especially with :
> 
> - open() call 
> - pipes and sockets
> - tty's and ptys
> - cat() command
> 
> What is the best way to control the case where \r characters are
> inserted in front of each \n.
> 
> The problem is because I have a program which counts the bytes of a
> file, and I have to modifiy it in order to :
> -  count 1 byte at each newline under Unix
> - count 2 bytes at each newline under Win32
> 
> What is the best way to do that ??

First let me say read the documentation and search the archives.  There exists
lots of information on this subject.

Now, to answer the counting problem.  Open the files in O_BINARY or "rb" mode. 
The \r will then be returned as data and the number of characters returned by
the read will be correct.
===
YAWIA,
Earnie Boyd <mailto:earnie_boyd AT yahoo DOT com>

Newbies, please visit
<http://www.freeyellow.com/members5/gw32/index.html>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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