[net.micro.pc] How does a program know when a disk is changed.

arden@creed.UUCP (Bruce Arden) (03/27/85)

I have a program that needs to keep a file open for a long time.  
How can I be sure that someone hasn't changed the disk since I 
opened the file?  

I noticed a 'MEDIA CHECK' command for device drivers, but I can't
find any system call to do this check.  

I am using mostly 'Xenix compatible' system calls under PCDOS 2.0.
-- 
Bruce Arden
..!mcvax!ukc!stc-a!creed!arden

nather@utastro.UUCP (Ed Nather) (03/28/85)

> I have a program that needs to keep a file open for a long time.  
> How can I be sure that someone hasn't changed the disk since I 
> opened the file?  
> 
> Bruce Arden
> ..!mcvax!ukc!stc-a!creed!arden

If the disk in question has a file on it you can be sure has a unique
name (perhaps you could write one on it you're sure would be unique)
then you can search the disk for its existence.

In a .bat file, the "If exist filename ..." does that job.

Apparently DOS does it that way -- you can swap disks around if they have
the same directory names, and are "in" a subdirectory -- and DOS will leave
you there, on the new disk, if it hasn't seen you refer to that drive
and been unable to find the path it last saw.


-- 
Ed Nather
Astronony Dept, U of Texas @ Austin
{allegra,ihnp4}!{noao,ut-sally}!utastro!nather