Results 1 to 2 of 2

Thread: VB6 - Fastest method of IO with files Open or FSO

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    NJ, USA
    Posts
    326

    VB6 - Fastest method of IO with files Open or FSO

    Which code would be more efficient to use, especially going over a network connection (if that makes a difference). If the file is say 100 bytes to 1kB in size?

    VB Code:
    1. Open App.Path & "\test.txt" For Output As #1
    2.   Print #1, "insert string here"
    3. Close #1

    or

    VB Code:
    1. Dim txtFile As TextStream
    2.  
    3. Set txtFile = fs.OpenTextFile(App.Path & "\test.txt", ForWriting)
    4. txtFile.Write "insert string here"
    5. txtFile.Close

    Also, in this particular app, one copy of the file is saved locally, while the other is saved on a network share. Would copying the file using FSO be quicker or more efficient than opening the file and printing to it?
    VB.NET 2005 Express with .Net 2.0
    C# 2010 .Net 4.0

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: VB6 - Fastest method of IO with files Open or FSO

    For a small file, the first method will be faster. I haven't tested it on a network share yet. I am considering the file is placed locally.

    Will test in the office and let you know about network shares.
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

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