Mail Archives: djgpp/2001/02/15/08:51:45
"Rafael García" <rafael AT geninfor DOT com> wrote:
> I have a program that write some information about its work in a LOG file.
> When it ends execution I can open it to know what was happening.
> But it would be nice if I could read it meanwhile running. If I try to open
> the file for reading from another Windows DOS box, fopen() fails.
The fundamental problem is that DOS, by its very nature, is not a
multitasking operating system, i.e. it does not expect more than a
single program to be running in the system, at any given time. Neither
does your typical plain vanilla DOS program.
Now, obviously, network file systems and multitaks add-ons (i.e.:
Windows) have been used with DOS for a long time, so how could they do
that? They added a crutch to MSDOS to take care of the file access
sharing issues that arise, in these situations. That one was called
'share.exe', and it's the duty of every single DOS program, then, to
co-operate actively with 'share' in order to make the mose use of it.
(In Win9x, there is no manifest 'share.exe' TSR any more: its
functionality is now part of the automatically loaded IFSHLP.SYS
driver, IIRC).
> Is it possible to do?
AFAIK: yes. Look up the help on DJGPP's libc function 'open' to see
what additional mode bits to set to let other programs access your
files in readonly mode while you're still writing them. If you're
currently using <stdio.h> functions (i.e. fopen(), and FILE*
structures) to access files, you'll have to interface to the
<unistd.h> ones via fileno() and fdopen().
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -