Announcement

Collapse
No announcement yet.

Error 55

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error 55

    I have an odd problem. I'm getting error 55 (file is already open) when I know it isn't. I put in code to print out the file attribute of #1 to #20 and they are all zeros so no files are open (which is what the code should do at that time).

    I've checked my segment lengths, If-Then nesting, and the usual suspects.

    Does Error 55 ever mean anything else, or is there something else I should check.

    BTW, this error didn't exist in an earlier version of the code but I haven't been messing with any of the effected areas.

    Cheers!

    ------------------

  • #2
    have an odd problem. I'm getting error 55 (file is already open) when I know it isn't. I put in code to print out the file attribute of #1 to #20 and they are all zeros so no files are open (which is what the code should do at that time).
    ???

    Reading the attribute is not a valid test for open/not open; the file attribute is unaffected by the 'open or not' status.

    Sorry, you have a file open somewhere or tried to delete an open file, just as it says in the help file.

    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      THanks for the reply, but now I'm really confused. The manual says "FILEATTR(filenumber,0) indicates whether the file has been opened"
      Try this test code:

      CLS
      OPEN "testfile.tmp" FOR OUTPUT AS #1
      PRINT FILEATTR(#1,0) 'here is -1
      CLOSE
      PRINT FILEATTR(#1,0) 'here is 0
      END

      Or does it all mean something different from the File Already Open in the Error 55?


      ------------------

      Comment


      • #4
        > I put in code to print out the file attribute of #1 to #20 and they are all zeros so no files are open (which is what the code should do at that time).

        !!!

        The FILEATTR function is not the same as the file attributes. When one says "file attributes" one thinks of things like directory yes/no, read-only, system, hidden, etc. But I digress....

        How do you know the file number you are trying to open is between 1 and 20?

        Why don't you just trap the error with ON ERROR GOTO? Surely you can display the file name/number you were trying to open, the file which generated the error #55

        If you are sure it's error 55, I'm sure you are trying to open a file which is already open.

        I think the bottom line here is, you want help with code, you have to show that code.




        ------------------
        Michael Mattias
        Tal Systems Inc.
        Racine WI USA
        mailto:[email protected][email protected]</A>
        www.talsystems.com
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Perhaps you has a file that it was kept opened for another process badly finished - tries to erase such file!

          ------------------
          Arthur Gomide
          Como diria nosso profeta da bola, Dadá Maravilha: "Para toda Problemática existe uma Solucionática!"
          "The trouble with quotes on the Internet is that you can never know if they are genuine." - Abraham Lincoln.

          Comment


          • #6
            Thanks, all,

            After debugging for hours I was wondering if there was another trigger for of Error 55, and the answer is no, it means only what the manual says.

            So, I went back and looked again and found my error. FILEATTR=0 means a file is NOT OPEN. My code to close the file if open was assuming the opposite! Oops. FILEATTR=-1 means the file is OPEN.

            That does change things, doesn't it!?

            Anyway, thanks again!

            ------------------

            Comment


            • #7
              Perhaps you has a file that it was kept opened for another process badly finished - tries to erase such file!
              No, Arthur, the "File Already Open" error means the file buffer number used in the OPEN statement is already open; it does not refer to the physical file being opened.

              E.g. perfectly OK...
              Code:
              OPEN "Myfile" for INPUT AS #1
              OPEN "myFile" for INPUT AS #2
              (For any output-capable open mode SHARED is required in both statements or the second OPEN will fail on 'File in Use' or 'Permission Denied' error)

              But this...
              Code:
              OPEN anyfile for INPUT AS #1
              OPEN anyfile for INPUT AS #1
              .. will result in 'File Already Open' error because "#1" is already open.

              MCM

              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                [quote]Originally posted by Michael Mattias:
                No, Arthur, ...
                Ok, Michael, but
                What's going on?

                ------------------
                Arthur Gomide
                Como diria nosso profeta da bola, Dadá Maravilha: "Para toda Problemática existe uma Solucionática!"
                "The trouble with quotes on the Internet is that you can never know if they are genuine." - Abraham Lincoln.

                Comment


                • #9
                  My point was to clarify that if you get an error '55' the problem is with your program and your program alone.

                  'Other events on the system' such as another program 'crashing' will never cause a '55' error.


                  Michael Mattias
                  Tal Systems (retired)
                  Port Washington WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment

                  Working...
                  X