Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-Id: <5.0.2.1.0.20010214171434.00a8f6f0@pop.ma.ultranet.com> X-Sender: lhall AT pop DOT ma DOT ultranet DOT com X-Mailer: QUALCOMM Windows Eudora Version 5.0.2 Date: Wed, 14 Feb 2001 17:20:54 -0500 To: Jean Delvare From: "Larry Hall (RFK Partners Inc)" Subject: Re: file descriptors opened as text files Cc: cygwin AT sources DOT redhat DOT com In-Reply-To: References: <5 DOT 0 DOT 2 DOT 1 DOT 0 DOT 20010214165225 DOT 00a95e40 AT pop DOT ma DOT ultranet DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" At 05:08 PM 2/14/01, Jean Delvare wrote: >> Type "mount" on your system. What does it show? Is the file in question >> being written under any of these mount points? Any of them binary? >I think I understand the mount mechanism, and the binary vs text mode >mount. But I don't see the point when runing out of bash. Do you pretend >that the way I mount my drives with bash/mount changes the program >behaviour when I run it directly from Windows ? (I can hardly believe it) You proceed from a false supposition. mount is a stand-alone utility. It manipulates the way Cygwin sees the file system. It has nothing to do with bash. Since your program relies on Cygwin and Cygwin interprets the file system through the existence or absence of mount points, your program treats files as Cywgin would treat the files, with or without bash. >> Bingo. Cygwin treats files as text by default, unless you specify a >> different default. If you want your program to treat the file as binary, >> add the appropriate flags on the appropriate calls. Whamo! Your problem >> is solved. >I hope so. That's also the way I see the thing. The question is : What >flags ? >When using handles, I can solve the problem with fopen(f,"rb") instead of >fopen(f,"r"). And it works. But I read the whole read(2) man page (on >Linux, it doesn't exist on Cygwin) and nowhere I saw a flag that force >binary mode. Can you help ? On Linux/UNIX, there's no difference between "binary" and "text" files, so the added flag is inconsequential. However, it is standard so whether the docs mention it or not, its legal and will get you precisely what you want, in a portable way. >Anyway, thanks *a lot* for the help so far. Happy to be of service. Larry Hall lhall AT rfk DOT com RFK Partners, Inc. http://www.rfk.com 118 Washington Street (508) 893-9779 - RFK Office Holliston, MA 01746 (508) 893-9889 - FAX -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple