Streamreading a shared text file.

  • Thread starter Thread starter serdar c.
  • Start date Start date
S

serdar c.

hi there, i am working on a program that takes data from a text file with
streamreader.readline() method. the problem is , this text file is being
used by another application which appends lines to the end of file when a
customer buys something. (its a third party program that i cannot acces). my
concern is if my readline and the other programs append action conflicks
(maybe the third party program will get an access denied error) there may be
a data loss, which results loss of important sales data.

so, my question is is ther a way to prevent this happen? i must be sure that
this would never happen ..

thanx for spending ur time on reading, best regards.
 
serdar c. said:
hi there, i am working on a program that takes data from a text file with
streamreader.readline() method. the problem is , this text file is being
used by another application which appends lines to the end of file when a
customer buys something. (its a third party program that i cannot acces).
my concern is if my readline and the other programs append action
conflicks (maybe the third party program will get an access denied error)
there may be a data loss, which results loss of important sales data.

so, my question is is ther a way to prevent this happen? i must be sure
that this would never happen ..

You could use Shadow Copy to read your data from a snapshot of the file,
so the original file being written would be completely unaffected.
http://en.wikipedia.org/wiki/Shadow_Copy
http://technet.microsoft.com/en-us/library/cc785914.aspx
http://www.codeproject.com/KB/dotnet/makeshadowcopy.aspx?display=Print
 
hi there, i am working on a program that takes data from a text file with
streamreader.readline() method. the problem is , this text file is being
used by another application which appends lines to the end of file when a
customer buys something. (its a third party program that i cannot acces).my
concern is if my readline and the other programs append action conflicks
(maybe the third party program will get an access denied error) there maybe
a data loss, which results loss of important sales data.

so, my question is is ther a way to prevent this happen? i must be sure that
this would never happen ..

thanx for spending ur time on reading, best regards.

well, it depends of how the other program open the file, if it
requires exclusive access, then it will conflict with your program.
The best you can do is open the file in read only and with share
capabilities and TEST it
 
Back
Top