www.delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
DKIM-Signature: | a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=kfVQzENJ9rFphdXVi0IK3aI2qgmGpM2AyxWdMd8zMjXm+2LjywoIDSuPNkgpYzThVaiwyXfiQOuF4192eEwz1qynIViY6wO2Rtvjvtt5tOxaJyvou+JeQf2bXhOE69UgtzNjUGxWvQivI28XMoBvLy/rOPjfxJK8mHeZBHIr54E= |
Message-ID: | <ba40711f0702220753t216d8fbcs453e52c4414af21c@mail.gmail.com> |
Date: | Thu, 22 Feb 2007 10:53:43 -0500 |
From: | "Lev Bishop" <lev DOT bishop AT gmail DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Why binary mode? |
In-Reply-To: | <45DD8A8F.2050406@hima.com> |
MIME-Version: | 1.0 |
References: | <45DD6C91 DOT 5040406 AT hima DOT com> <45DD8A8F DOT 2050406 AT hima DOT com> |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
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 |
On 2/22/07, Sven Severus wrote: > But in a textmode mounted directory, 'echo peng >p.txt' creates > a 6 byte long file containing 'p' 'e' 'n' 'g' '\r' '\n'. > OK, exactly as expected. Now I thought, 'cat p.txt' would open > this file for reading in textmode, according to the default rule. > > This is, what I expect, after reading the Cygwin FAQ: > "When processing in text mode, [...] written to the file [...] > you in fact get "Hello\r\n". Upon reading this combination, > the \r is removed [...]". > Why is it in fact not removed when reading with cat? Because cat is required by posix to read in binmode. Try, for example: $ echo peng >p.txt && read CO <p.txt && od -c <<<"$CO" 0000000 p e n g \n 0000005 -- 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 |