delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/28/04:31:52

Date: Sun, 28 Jun 1998 11:31:23 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Theo Landgraf <tla AT pac DOT nl>
cc: "djgpp AT delorie DOT com" <djgpp AT delorie DOT com>
Subject: Re: _fsopen
In-Reply-To: <359354EA.B2EC7B60@pac.nl>
Message-ID: <Pine.SUN.3.91.980628113050.8147L-100000@is>
MIME-Version: 1.0

On Fri, 26 Jun 1998, Theo Landgraf wrote:

> how can i open a file with file-sharing....
> 
> usually it's _fsopen, but it's not in libc.

Currently, there's no _fsopen in DJGPP's libc.  To get the same
functionality, use `open' with the sharing bits you want, then call
`fdopen' to get a FILE *.  For example (UNTESTED!):

	 #include <stdio.h>
	 #include <fcntl.h>
	 ...
	 int fd = open ("foo", O_WRONLY | O_BINARY | SH_DENYWR, 0666);
	 FILE *fp = fd < 0 ? NULL : fdopen (fd, "wb");

- Raw text -


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