Results 1 to 7 of 7

Thread: start the reading file from...

Hybrid View

  1. #1
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: start the reading file from...

    Unless every line is exactly the same length, you have no way of being able to jump to a specific line in the file.

    Reading the entire file into memory works well for small files, not large files (depends on system resources)
    1. Either loop line by line until you get to the line you are looking for, or

    2. Open the file for BINARY and read a chunk of the file at once. You can play with the chunk size to optimize performance. Maybe start out at like 32kb at a time and go all the way to 500kb at a time
    - There are projects in the CodeBank section for searching a file quickly. Think those might help
    - The problem with searching chunks is that if the criteria you are searching for happens to be split between chunks. Solving this problem is easy enough, when criteria not found in current chunk, start reading the next chunk a few bytes (length of your criteria) before where the current chunk ended. By opening file as Binary, you can tell it where to start reading each time you attempt a read
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,941

    Re: start the reading file from...

    Quote Originally Posted by LaVolpe View Post
    Unless every line is exactly the same length, you have no way of being able to jump to a specific line in the file.

    Reading the entire file into memory works well for small files, not large files (depends on system resources)
    1. Either loop line by line until you get to the line you are looking for, or

    2. Open the file for BINARY and read a chunk of the file at once. You can play with the chunk size to optimize performance. Maybe start out at like 32kb at a time and go all the way to 500kb at a time
    - There are projects in the CodeBank section for searching a file quickly. Think those might help
    - The problem with searching chunks is that if the criteria you are searching for happens to be split between chunks. Solving this problem is easy enough, when criteria not found in current chunk, start reading the next chunk a few bytes (length of your criteria) before where the current chunk ended. By opening file as Binary, you can tell it where to start reading each time you attempt a read
    not for me tks friend

    can i send my txt file and chat in msger or skipe or fb?

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,941

    Re: start the reading file from...

    Quote Originally Posted by LaVolpe View Post
    Unless every line is exactly the same length, you have no way of being able to jump to a specific line in the file.

    Reading the entire file into memory works well for small files, not large files (depends on system resources)
    1. Either loop line by line until you get to the line you are looking for, or

    2. Open the file for BINARY and read a chunk of the file at once. You can play with the chunk size to optimize performance. Maybe start out at like 32kb at a time and go all the way to 500kb at a time
    - There are projects in the CodeBank section for searching a file quickly. Think those might help
    - The problem with searching chunks is that if the criteria you are searching for happens to be split between chunks. Solving this problem is easy enough, when criteria not found in current chunk, start reading the next chunk a few bytes (length of your criteria) before where the current chunk ended. By opening file as Binary, you can tell it where to start reading each time you attempt a read
    Friend have you see my last reply on this question...?

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