www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/11/05:55:34

Date: Thu, 11 Mar 1999 10:56:32 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Junior System Administrator <pete AT restall DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: File modes
In-Reply-To: <199903101950.TAA01519@basil.restall.net>
Message-ID: <Pine.SUN.3.91.990311105611.19994H-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 10 Mar 1999, Junior System Administrator wrote:

> 	1). Can I lock regions of memory in DJGPP without using assembly ?

Of course.  Use either __dpmi_lock_linear_region or
_go32_dpmi_lock_code and _go32_dpmi_lock_data.

> 	2). Is there a portable way (conforming to the ANSI standard) to get
> 	    the mode of an already open file (opened with 'fopen()').  Is
> 	    there a function, or a field within the 'FILE *' type, that can
> 	    tell me ?

What exactly do you mean by ``mode''?  If you mean text/binary mode,
then use `setmode' and pass it fileno(fp), where fp is a FILE * result
returned by `fopen'.

If you mean the read/write etc. mode bits, use fstat with the same
fileno(fp) as an argument.

Neither of these is ANSI, but `fstat' is Posix.  Both have serious
portability problems either to other DOS/Windows compilers (fstat and
setmode) or to Unix (setmode).

- Raw text -


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