Announcement

Collapse
No announcement yet.

Why the file errors???

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

  • Why the file errors???

    This is a (hopefully) simple question:

    I am setting up three file handles and opening two of them (the third is opened later). I get an error 55 (file is already open) on the second one.

    Here is the code snippet:

    fileWeb% = FREEFILE
    htcp% = FREEFILE
    fileStock% = FREEFILE

    OPEN $filnam FOR INPUT AS fileWeb%
    OPEN $file1 FOR OUTPUT AS fileStock% ' This gives err=55

    If I change the second one to the following, it works fine:
    OPEN $file1 FOR OUTPUT AS #8

    This code is in PBMAIN and no files have been opened prior to this. What is going on?

    Dale


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

  • #2
    Originally posted by Dale Gillilan:
    fileWeb% = FREEFILE
    htcp% = FREEFILE
    fileStock% = FREEFILE

    OPEN $filnam FOR INPUT AS fileWeb%
    OPEN $file1 FOR OUTPUT AS fileStock% ' This gives err=55

    Freefile doesn't increment just by calling it. It will remain unchanged until you open another file.
    So - you are setting fileWeb%,htcp% and fileStock% to the same value.
    You need to do this:

    fileWeb% = FREEFILE
    OPEN $filnam FOR INPUT AS fileWeb%
    fileStock% = FREEFILE
    OPEN $file1 FOR OUTPUT AS fileStock%



    ------------------
    Check out my free software at http://www.lexacorp.com.pg(all written in PB/DLL)

    Comment


    • #3
      Thanks, Stuart.

      I knew it had to be a "basic" problem. I tried everything I could think of, EXCEPT what you suggested. Again, thanks. I learned something new.

      Dale

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

      Comment

      Working...
      X