Mail Archives: djgpp/1997/04/11/08:35:53
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 -