News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Fast text file to string array routine for Visual Basic (VB6)

Started by jj2007, January 03, 2016, 11:37:42 PM

Previous topic - Next topic

jj2007

With a few declarations and three lines of code, VB6 users can dramatically speed up their text to array code (to e.g. 8 ms/MB or 125kB/ms on an Intel i5):

    NumStrings = RecallMb("Bible.txt")
    ReDim Rec$(NumStrings)
    'SortMb         ' optional: sort strings alphabetically; ignore case and leading spaces
    SetStringsMb Rec$(0)


Sources and DLL attached. Of course, under the hood it's Recall().

Optionally, an equally fast sort algo is included.

For testing, you will need a huge text file, here are two suggestions:
http://patriot.net/~bmcgin/kjvpage.html
http://www.gutenberg.org/files/30/old/bible13.zip

EDIT: Masm4VB.zip contains a more advanced example. The *.asc source opens in RichMasm or Wordpad.
You can drag any text file over the exe, preferably a bible, because it searches for lines containing some keywords that appear more than once in the file, see ExtractDLinesMb in Form.