Mail Archives: djgpp/1998/06/28/04:31:52
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 -