04-07-2026, 10:01 PM
closing a txt file in small basic, I found a link that said it wasn't necessary, but instead if I try to run the program 2 times it gives me an error, because the file is already in use by another task
|
close a file
|
|
04-07-2026, 10:01 PM
closing a txt file in small basic, I found a link that said it wasn't necessary, but instead if I try to run the program 2 times it gives me an error, because the file is already in use by another task
Hi,
It shouldn't be necessary in general, unless possibly if the two codes are actually in the process of a read at the same time. I tested with a small code below and could not reproduce an issue, even when run 10+ instances of the program at the same time. Code: fileName = Program.Directory+"\largefile.txt"Possible reasons for your issue: 1] The file is open in another non SB program. 2] You are using ReadContents on a very large file and it is actively reading it. Please share a small sample program that shows the issue and more details, like the size (number of lines etc) of the text file you are reading, how you are running multiple versions of your SB code etc. i.e. Sufficient details for someone to have a good chance to reproduce the problem. If we can't reproduce an issue then we are guessing.
7 hours ago
You were right. In fact, there were two versions of the same program in the run. Now I have encountered another problem that I will put in a new post. thank you.
|
|
« Next Oldest | Next Newest »
|