[M3devel] random-acces I/O

Dragiša Durić dragisha at m3w.org
Sun Mar 2 00:41:19 CET 2008


On Fri, 2008-02-29 at 17:41 -0500, hendrik at topoi.pooq.com wrote:
> I need to do direct-access I/O from a Modula 3 program with a file 
> format that is externally specified.  It is necessary to both read and 
> write in random fashion during a run of the program, prefereably without 
> having to close or open the file each time.
> 
> I expect the answers to the following questions are "Yes", but I'd 
> appreciate confirmation:
> 
>   ? If I have a File.T (obtained from FS.OpenFile) can I have both a 
>     Rd.T and a Wr.T active on it simultaeously?

  Yes

> 
>   ? Will things written using the Wr.T be immediately available 
>     for reading with the Rd.T, with no buffereing problems?

  Most probably you'll have to use unbuffered IO here.

> 
>   ? Are there methods for locking the file -- or portions of it --  
>     against simutaneous access by other programs, including ones written 
>     in other languages?

  There are. But you have to make some rules, and follow them from all
users of your file.

> 
> -- hendrik
-- 
Dragiša Durić <dragisha at m3w.org>




More information about the M3devel mailing list