Is there a way to ignore a process in c# as a text file is being used by another process?

208 Views Asked by At

Im trying to use magnetic swipe card machine to clock in users to a database i have everything working however my c# code that i use to read the text file which the swipe card software writes to pauses as the file is being used by another process, so i was wondering is their a way for my c# program?

1

There are 1 best solutions below

1
Youri Leenman On

Do you have acces to the program that is using the text file? if so you could solve this problem using

File.WriteAllLines()

this won't keep the file open.

read the file with

File.ReadAllLines()