From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: reading a currently writting file Date: 15 Feb 2001 13:34:52 GMT Organization: Aachen University of Technology (RWTH) Lines: 34 Message-ID: <96glts$mn5$1@nets3.rz.RWTH-Aachen.DE> References: <3a8bc878 AT filemon DOT telecable DOT es> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: nets3.rz.RWTH-Aachen.DE 982244092 23269 137.226.32.75 (15 Feb 2001 13:34:52 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 15 Feb 2001 13:34:52 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Rafael García" 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 functions (i.e. fopen(), and FILE* structures) to access files, you'll have to interface to the 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.