www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/11/08:35:53

From: Bernhard Baeumle <bb AT ife DOT ee DOT ethz DOT ch>
Newsgroups: comp.os.msdos.djgpp
Subject: Final comments: (Re: Desperately need help with "fopen")
Date: Thu, 10 Apr 1997 17:48:27 +0200
Organization: Electronics Lab
Message-ID: <334D0BCB.5E1B@ife.ee.ethz.ch>
References: <334B568B DOT DBF AT ife DOT ee DOT ethz DOT ch>
NNTP-Posting-Host: quincy.ee.ethz.ch
Mime-Version: 1.0
CC: Robert DOT Hoehne AT Mathematik DOT tu-chemnitz DOT de, alaric AT abwillms DOT demon DOT co DOT uk,
eliz AT is DOT elta DOT co DOT il, bukinm AT inp DOT nsk DOT su
Lines: 40
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Final comments about: "Re: Desperately need help with "fopen"

This was quite confusing... 
...some programs DO lock the file they opened and other programs dont.
...some programs can still read those files and others cant...
No Windows95- and MSWord-expert knew about a way to turn off MSWord
locking files!
...and some gcc-gurus could not believe that 'fopen("bla","r")' could
fail only because the file is opened with MSWord (no offence).

Robert Hoehne proposed to use _dos_open() instead of fopen() but finally
it was Michael Bukin (bukinm AT inp DOT nsk DOT su) who posted code which allows to
solve the problem:

...
  _dos_open (filename, O_RDONLY | SH_DENYNO, &handle);
  file = fdopen (handle, "r");
  fgets(..., ..., file);
...
MANY THANKS AGAIN to Michael.

The problem is now solved but I still do not understand why there had to
be a problem at all!
- SH_DENYNO = "Deny none mode"
  ===> so what kind of flag was set by MSWord that has to be denied???
- No matter what the flag is meant for, why can some programs read and
others can not? Why do some programs set this flag and others dont?
- ... and why is DJGPP's fopen() the only function I found which has
problems with reading??? (so "SH_DENYNO" should be the default!?!?)

Thanks again for all your help!!!

Beni
+-----------------------------------+-------------------------------+
| Bernhard Baeumle                  |                               |
| Swiss Federal Inst. of Technology | Phone: (+41) 1 632 51 53      |
| Electronics Lab, ETZ H60.1        | FAX  : (+41) 1 632 12 10      |
| Gloriastr. 35                     | Email: bb AT ife DOT ee DOT ethz DOT ch      |
| 8092 Zuerich (SWITZERLAND)        | http://www.ife.ee.ethz.ch/~bb |
+-----------------------------------+-------------------------------+

- Raw text -


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