Results 1 to 5 of 5

Thread: opening multiple files

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    Is it posssible (i think it should) to open multiple files, i keep getting a file already open warning even though i have give different file id for each file, CAN ANYONE HELP?

    Many Thanks

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Of course it is possible to have multiple files open. I have done it many times myself. I take it you are using the FreeFile function to return a file number.

    The error sounds like another program is using the file, or that you have opened it before and not closed it.

    Good luck.
    Iain, thats with an i by the way!

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446

    OPEN FILE

    ExecCmd ("cmd /c ""dir e:\netvespaweb >e:\Centra~1\Cabini~1\DirectoryFolder.txt /s /b /a:d""")
    'Create a file with file listings
    ExecCmd ("cmd /c ""dir e:\netvespaweb >e:\Centra~1\Cabini~1\FileFolder.txt /s /b """)


    Open "e:\Centra~1\Cabini~1\DirectoryFolder.txt for Output as #2

    Open szNameCabIni For Input As nCabIniID


    Why do i get the error when freefile is used for th nCabIniID?

    Many Thanks

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446

    mmmmH

    What i want to do is open a file, open another, then write contents of one file to another file so i would like both files open.

    "As anybody got a clue, what to do..." BLOCK BUSTER...!!!

    D'oh..!!

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    As Iain said use Freefile to locate next free filenumber. You should use this number in all operation with that file so store them in variables as follows:
    Code:
    Dim ff1 as integer, ff2 as integer
    ff1 = freefile
    open file1 as input as ff1
    ff2 = freefile
    open file1 as input as ff2
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width