Results 1 to 4 of 4

Thread: FreeFile

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    Ireland
    Posts
    8

    Post

    My application is used by a number of users, all accessing(writing) to the same file.
    Currently like so:

    Open Filename For Append Access Write Lock Write As #1

    If a user is writing to the file & another user tries to access the file, permission is denied. Error handler displays a message. Try later!!!

    Should I hard-code file number, #1 or use Freefile to obtain next available number. Only one user can open & write to the file at once...

    What are the benefits of using freefile, espcially with multiple users?

    Gerry.

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923

    Post

    You should use freefile in preference to a number every time in my opinion. Benefit being it is guaranteed to work (at least, it won't bust due to invalid file number).

    There is no real point not using FreeFile (apart from 2 extra lines of code...damn! )

    Hope that clears it up

    Regards,

    ------------------
    - Chris
    chris.kilhams@btinternet.com
    If it ain't broke - don't fix it


    [This message has been edited by chrisjk (edited 11-30-1999).]

  3. #3
    Guest

    Post

    also, using #1 may cause untold damage to "that comma-delimited file that i left open in notepad, which my customer desperately needs for tomorrow morning". Bitter, bitter experience!

    examples of mad people who probably dont use FREEFILE:...
    Evel Kneivel, Charly Manson, that feller out of hellraiser. (names changed to stop nasty libel proceedings)!

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

    Wossname,
    Email me: wossnamex@talk21.com

  4. #4
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Post

    Using Freefile has nothing to do with multiple users. If you open multiple files from your application, it can be hard to make sure you haven't used the filenumber for another file already. Using Freefile makes sure you get a filenumber that isn't used already by your application. Also using #1 (or #9 or whatever) isn't as clear as using:

    hLogFile = FreeFile
    Open Filename For Append Access Write Lock Write As #hLogFile

    Now the variable gives a clue about the purpose of the file, so if you open the file in line 100 of your code and you write to it in line 1050, it will be more easy to understand if you have to modify the app in a year or so.

    So in my opinion, using FreeFile is recommended.

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