simultaneous access to flat file

F

Frank

Hello all,
I have to access a flat file (.txt or something) by two applications at the
same time. For reading and writing. Is that possible and how?
Thanks
Frank
 
S

Samuel R. Neff

A text file should be fine, if both processes open it with shared
write access (or read/write) then they can both write to it (or read).
If it's a simple file like a log file then it should be ok but you
could get occasional hiccups where text from one write is in the
middle of another unless you use some type of cross process
synchronization (i.e., Mutex).

XML is different though.. because XML has to be well formed it would
be very difficult to have to applications both write to the same file
and ensure that the resulting file is still well-formed after every
write. You'd need to synchronize the processes and whenever one wrote
to the file it triggered the other to read the changes and sync it's
internal structure. It'd be far more reliable to have only one of the
processes actually read/write the file and the second process can
communicate back with the first to interact with it (Remoting).

HTH,

Sam


------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top