delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/09/06:41:49

Date: Wed, 9 Apr 1997 13:18:38 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Bernhard Baeumle <bb AT ife DOT ee DOT ethz DOT ch>
cc: djgpp AT delorie DOT com
Subject: Re: Desperately need help with "fopen"
In-Reply-To: <334A793E.69D0@ife.ee.ethz.ch>
Message-ID: <Pine.SUN.3.91.970409131806.3639I-100000@is>
MIME-Version: 1.0

On Tue, 8 Apr 1997, Bernhard Baeumle wrote:

> fopen("test.txt", "r") returns NULL as long as I have this file
> ("test.txt") opened with MS Word for Windows. Other programs (emacs,
> editor, notepad and DOS' type) have no problem reading the file!!! As
> soon as I close the file (it's no longer opened with Word) then
> fopen("test.txt", "r") works fine!

Which Emacs did you use?  Is that Emacs compiled with DJGPP for MS-DOS
and MS-Windows?  If so, it just uses `open' instead of `fopen'.  I
don't think this should matter (`fopen' calls `open' internally), but
you can try using `open' in your program and see if that helps.

> It seems there is some file-locking (sharing) mechanism with Win95 but
> shouldn't it be possible to open the file for reading?????????

There *is* a file-locking mechanism in Windows 95; it is called VSHARE
and is a 32-bit replacement for the DOS SHARE.EXE TSR.  I don't know
how does Word open its files as far as sharing permissions are
considered.  However, the fact that some programs are being able to
open that file means that there *is* a way to open the file for
reading while it is still open by Word.  You will need to find that
way.

OTOH, there is a possibility that this is not at all a problem with
`fopen', but somewhere else in your program (no offence).  Can you
post the shortest test program that fails in the above case, and the
description of what should be done to reproduce the problem?

- Raw text -


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