delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/03/17/20:15:43

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <49C04B2D.2090703@cwilson.fastmail.fm>
Date: Tue, 17 Mar 2009 21:15:25 -0400
From: Charles Wilson <cygwin AT cwilson DOT fastmail DOT fm>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.6.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: _set_fmode?
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

Is there a cygwin analogue to the msvc _set_fmode()? That is, a function
that sets the default mode of fopen, even if you don't explicitly
specify it "rb" or whatever.

Obviously, there's "use binary (or text) mounts".  Less obviously, you
can link against /usr/lib/binary.o (or -lbinmode), or text.o (or
automode.o or textreadmode.o and the similar .a's).  But I'm looking for
an actual function call to replace the following code in libarchive:

+#if defined(_WIN32) && !defined(__CYGWIN__)
   /* Make sure open() function will be used with a binary mode. */
   /* on cygwin, we need something similar, but instead link against */
   /* a special startup object, binmode.o */
   _set_fmode(_O_BINARY);
 #endif

I'm using binmode.o at present, but I'd prefer to just make a func call
at the same place the WIN32-specific code does.  (FWIW, you can't call
the w32api _set_fmode() function and expect it to work; the msvc runtime
and cygwin maintain different default _fmode variables).

--
Chuck

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019