We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
close a file
#2
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"
While ("True")
  line = File.ReadLine(fileName,1)
  TextWindow.WriteLine(line)
EndWhile

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.
Reply


Messages In This Thread
close a file - by francesco - Yesterday, 10:01 PM
RE: close a file - by litdev - 11 hours ago

Forum Jump:


Users browsing this thread: 1 Guest(s)