Jump to content

Recommended Posts

Posted

$ap = 0
While 1
    FileOpen("rga.sav", 2)
    FileWrite("rga.sav", '$ap = ' & $ap)
    FileClose("rga.sav")
    $ap = $ap + 1
WEnd

On Version 3.1.1.0 it works perfectly. But on Versio 3.1.1.84 beta this error appears:

Unable to open file, the maximum number of open files has been exceeded.:

FileOpen("rga.sav", 2)

I know that the maximum number of open files _in the same time_ is 64, but FileClose should solve this problem.

Greets.

Posted

$ap = 0
While 1
    FileOpen("rga.sav", 2)
    FileWrite("rga.sav", '$ap = ' & $ap)
    FileClose("rga.sav")
    $ap = $ap + 1
WEnd

Greets.

Ermmm....

$ap = 0
While 1
    $FileHandle = FileOpen("rga.sav", 2)
    FileWrite($FileHandle, '$ap = ' & $ap)
    FileClose($FileHandle)
    $ap = $ap + 1
WEnd
Posted

The doc say FileWrite("filename") must not be mixed with FileOpen("filename")

Note: Do not mix filehandles and filenames, i.e., don't FileOpen a file and then use a filename in this function.Either use filehandles or filenames in your routines--not both.

Perhaps some code cleaning in the beta make this statement really true now B)

Posted

it was working due to a bug in 3.1.1

the fileClose cannot use a filename but the integer value of a string is 0 so it was closing the file open by Fileopen.

It was just a luck.

I correct Fileclose to avoid closing the first open file and you get now the correct behavior whatever the doc say about the not mixing stuff.

B)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...