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 Reply-To: earnie_boyd AT yahoo DOT com Subject: Re: binary/text files To: Aldo Mazzilli , cygwin AT sourceware DOT cygnus DOT com Cc: Aldo DOT Mazzilli AT inrialpes DOT fr MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii --- Aldo Mazzilli 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 Newbies, please visit _________________________________________________________ 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