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-Authentication-Warning: eos.vss.fsi.com: ford owned process doing -bs Date: Tue, 9 Dec 2003 14:55:58 -0600 (CST) From: Brian Ford X-X-Sender: ford AT eos To: Jeff Gilchrist cc: cygwin AT cygwin DOT com Subject: Re: 1.5.5-1: problem with read() on Athlon MP in WinXP In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Note-from-DJ: This may be spam Please don't include plain text email addresses in the body of messages. It is food for spam harvesters. Thanks. On Tue, 9 Dec 2003, Jeff Gilchrist wrote: > Brian Ford wrote: > >It sounds like you may have two problems here, but this may be the first > >one: > > > >http://cygwin.com/cygwin-ug-net/using-textbinary.html > > > Well don't I feel like a newbie. That was the problem. I was reading in > binary data and forgot to add the O_BINARY flag to open(). As soon as I did > that, it worked fine on my Athlon system. > > Not sure why it did work on the other two machines but I guess that was just > a fluke. :) I posted the test.c as the minimal amount of code out of a > larger program that I had written where I was having the problems. The same > code that doesn't work under cygwin on my Athlon was running fine under > Linux on the same Althlon and Solaris on a Sparc too so I never suspected > something simple as leaving out a O_BINARY. > > Since my code did work fine under Linux and Solaris, is this an artifact of > cygwin having the option to treat files in "DOS" or "Unix" format by > default? Or is this an actual bug in how cygwin handles binary data if the > "BINARY" flag isn't set? I converted my code to use fopen()/fread() instead > and still had the same problem if I didn't speciy the "b" flag. > Bingo! Cygwin doesn't know the difference between text and binary data. It uses one of open(O_BINARY), CYGWIN=[no]binmode, and "mount -b" to determine how to treat a file. Check the output of mount on the systems with differing behavior. I'd bet you selected a default mode of UNIX on the working systems and DOS on the Athlon. > Thanks, this solves my problem and your answer is much appreciated. > You're welcome. -- Brian Ford Senior Realtime Software Engineer VITAL - Visual Simulation Systems FlightSafety International Phone: 314-551-8460 Fax: 314-551-8444 -- 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/