1

How can I use same text file to read and write in it at same time using different applications for reading and writing. It should be safe since same file will be accessed from 100+ devices

Previously I found questions, in which file was accessed from same application, I want to access from different applications

Mubi
  • 11
  • 1
  • 8
  • 3
    A text file is the wrong media for this kind of scenario. Use a database – Steve Mar 28 '17 at 15:42
  • A single file shared by 100+ devices, safe, etc. It's a crazy scheme. It sounds a lot like a database. Why not use a database? – spender Mar 28 '17 at 15:43
  • I doubt if this can be possible with a text file. for this purpose there are database systems in which concurrency can be handled. – Ambrish Pathak Mar 28 '17 at 15:43
  • 1
    And how would you manage the lock on the file being attempted by each device...dont do it! – Wheels73 Mar 28 '17 at 15:44
  • The exact question already asked many times on SO. Note that this approach probably not applicable to your particular scenario - as comments say text file is unlikely good format for multiple parallel updates (also indeed you can use fixed length strings to be able to seek through the file). – Alexei Levenkov Mar 28 '17 at 16:10
  • FileShare.None, FileStream.Lock and FileStream.Unlock will these not work? – Mubi Mar 28 '17 at 17:40

0 Answers0