Announcement

Collapse
No announcement yet.

Does "close" ever set an error?

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

  • Does "close" ever set an error?

    Hello all,

    Well here I am with another installment of...

    STUPID POWERBASIC QUESTIONS!!! yaaaa!


    Anyway, I was wondering if there is ever any need to check for
    an error when using "CLOSE" in PBDLL. I think it would be really
    usefull if we could get a list of possible error codes for each
    PowerBasic keyword.


    Thanks again!

    ------------------
    Cheers

  • #2
    I don't think that the compiler creates any error messages for close.

    You can even do this and it won't bomb out:

    function pbmain()
    Close #2
    Close #7
    end function

    I think the only error that would be caused is a syntax error like
    this:

    Code:
    function pbmain()
        close [b]&2]/b]
        close #7
    end function
    
    The only other thing I can think of is:
    
    function pbmain()
        open "blah" for binary as #55
        close #56
        open "blah2" for binary as #55
        close #55
    end function


    ------------------
    -Greg
    -Greg
    [email protected]
    MCP,MCSA,MCSE,MCSD

    Comment


    • #3
      Gregery,

      I don't think this is what Mark has in mind.
      He wants to know (correct me if I'm wrong, Mark) whether a Basic keyword leaves a message behind in the form of a so called 'error level' code.
      It would be vere interesting, indeed, to know those codes!
      If they exist.
      Regards,

      ------------------
      mailto:[email protected][email protected]</A>
      www.basicguru.com/zijlema/

      Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
      http://zijlema.basicguru.eu
      *** Opinions expressed here are not necessarily untrue ***

      Comment


      • #4
        Mark --

        > any need to check for an error when using "CLOSE"

        Yes. For example, if M: is a mapped network drive...

        Code:
        FUNCTION PBMain
            OPEN "M:\TEMP.TXT" FOR OUTPUT AS #1 
            PRINT #1,"HELLO"
            PRINT "Kill the network connection now, then press a key..."
            WAITKEY$
            CLOSE #1
            PRINT ERR
            WAITKEY$
        END FUNCTION
        ...will display an ERR number that was generated by the CLOSE statement.

        -- Eric

        ------------------
        Perfect Sync: Perfect Sync Development Tools
        Email: mailto:[email protected][email protected]</A>



        [This message has been edited by Eric Pearson (edited October 07, 2000).]
        "Not my circus, not my monkeys."

        Comment


        • #5
          The error codes returned by the compiler depend on the error codes
          returned by the operating system. This can vary considerably even
          on the assorted Windows flavors: 95, 98, Me, NT, 2000. So, we can't
          really provide a definitive list of what errors may be returned by
          a given BASIC keyword.


          ------------------
          Tom Hanlin
          PowerBASIC Staff

          Comment

          Working...
          X