PDA

Click to See Complete Forum and Search --> : Rules of file numbers


Janitor
Jan 11th, 2000, 03:35 AM
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.

MartinLiss
Jan 11th, 2000, 03:55 AM
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:

intFileNbr = FreeFile

Open MyFile For Input As intFileNbr _File


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

Janitor
Jan 11th, 2000, 04:02 AM
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.

MartinLiss
Jan 11th, 2000, 05:25 AM
Could you solve your problem by appending a unique number (perhaps the spawned number) or string to the file names?

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

Janitor
Jan 11th, 2000, 05:50 AM
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.