Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Info: This message was accepted for relay by smtp03.mrf.mail.rcn.net as the sender used SMTP authentication X-Trace: UmFuZG9tSVaesH69ZVJHWTHjPBGOSijMvDzrZS3ld9nvG8kMYAwyf0RsqHoQkcq5 Message-ID: <3F302212.3000303@cygwin.com> Date: Tue, 05 Aug 2003 17:30:58 -0400 From: Larry Hall Reply-To: cygwin AT cygwin DOT com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Brian Dessent CC: "'cygwin AT cygwin DOT com'" Subject: Re: Install 1.3.22-1 problem - default text file type - DOS References: <9B501B3774931C469BCCCC021BE5372277AD58 AT remailnt2-re01 DOT westat DOT com> <3F301AE1 DOT 8CAC9291 AT dessent DOT net> In-Reply-To: <3F301AE1.8CAC9291@dessent.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Brian Dessent wrote: > Francis Harvey wrote: > > >>Thanks. I have now replaced \n with \r\n every place I used \n in a >>character string. I have made sure not to switch the single character >>when used separately from a string. Everything appears to work fine >>now. > > > But that completely misses the point of "text" mode. You should always > use just "\n" in your strings in the source code, and open any files > containing text in "text" mode i.e. fopen("foo", "rt"). That way, when > you read and write to the file "\n" will be converted to "\r\n" by the > io library, but your code will be portable to any other posix system. > > If you explicitly use "\r\n" in your program then you have to make sure > the file is always opened in binary mode otherwise you'll could get ^^^^^^ opened and _written_ > "\r\r\n" as your line delimiter. > > Brian -- 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/