Results 1 to 5 of 5

Thread: Rules of file numbers

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    Atlanta, GA
    Posts
    75

    Post

    Could someone give me a brief description of how the file numbers work in manipulating files (i.e. opening, reading, writing, closing)? One particular that I am interested in: are the file numbers particular to the program involved or global to the machine? Thanks.

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    I assume they are particular to the program running. I'm going to guess that you are concerned with assigning a number already in use. If that's the case, always use code like the following:
    Code:
        
        intFileNbr = FreeFile
              
        Open MyFile For Input As intFileNbr _File

    ------------------
    Marty

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    Atlanta, GA
    Posts
    75

    Post

    Actually, I ran into a problem that I was hoping I could help solve with this answer. I have a program that goes through a couple of web pages, finds a particular page, pulls and formats the page, and saves it as a text file. During a run, I spawn about 15 of these programs. The problem is that occasionally two of the programs seem to write to the same file. I am currently using FreeFile, but was wondering if this could be a problem with grabbing and writing to the same file number. Thanks.

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    Could you solve your problem by appending a unique number (perhaps the spawned number) or string to the file names?

    ------------------
    Marty

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    Atlanta, GA
    Posts
    75

    Post

    Thanks for your help. I actually discovered that my problem was else where. Additionally, according to the MSDN help (which I failed to scour earlier), file numbers are exclusive to the program. I guess I need to hunt better.

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