Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Reading A Large Text File


At about line 1,426 VB decides it doesn't want to read anymore. How can this be fixed?


Code:
Dim ff As Integer
Dim readme As String
ff = FreeFile
Open readmes_path & "" & frmReadmes.File1.FileName For Input As #ff
readme = Input(LOF(ff), ff)
Text1.Text = readme
Close #ff




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Reading Large Text File
thanks for trying guys but still hanging. STARMAN - that would make sense, how would i found this out or go about replacing the characters??

Reading Last Line Of Very Large Text File
Hi

Can anybody please tell me a way of reading the last line of a very large text file.

Each line is of a fixed length and are comma seperated.

Any help would be most appreciated

Scouse

Reading A Large Line Of Text From A File
I have log files that can be easily read using notepad and such. Though it is seen as one big long line of info when reading this into a string, ie



Code:
strString as string
Open C:file.000 for Input as #1
Line Input #1, strString
the file ranges from 3-5 MB.
loading the string takes about 1 full minutes to do the input part, (processor cranks up a bit, using a decent machine 2Ghz with 1Ghz ram)

not to mention the lengthy time it takes to hack up the string once I do get it loaded. I have searched and looked at many of the File I/O threads, but did not find one that related to my one line 4mb file. How can I speed this up.

Reading Last Line Of A Very Large Text File?
Hi

Can anybody please tell me a way of reading the last line of a very large text file.

Each line is of a fixed length and are comma seperated.

Any help would be most appreciated

Scouse

I Need Help Reading From A Large Text File, And Rewriting Each Single Word
Here's what I have. I have a large text document with all the 5 letter words. I've attached the file so people can see. I got the list from an online dictionary.

Now - it seems to be broken up by space. So it's a word, then a space, then a word, then a space, word, space, etc, etc. From A-Z

Now - what I need help doing is opening the file (no problem), then reading each word one by one and adding it to a premade text file named Letter.txt (where the letter is the first letter of the word).

So - basically I want it to open the file, read the first word and toss it into the A.txt file, then the next word and toss it into the A.txt file, when it gets to B it throws those words into the B.txt file.

I can only seem to read the file as one long string when I try to read it, so I'm having trouble with that.

I could just copy all of the A words to the text file, and then manually seperate each one on its own line - but that would take a lot of time.

Reading A Large Text Field
Hi,

I'm having trouble reading a large varchar field from an SQL 2005 Database into a form in Access. I've been using the function below but just discovered that with large fields its only getting part of the field. I've done some research and i think I need to use the GetChunk method. I can't find any documentation on using it for this purpose. When I've tried I've been told that I cannot use the method in "this context".


Code:
Private Function UpdateScript(intPoint As Integer)
Dim adoData As ADODB.Recordset, ContactRec As Integer, txtLabel As String

Set adoData = CreateObject("ADODB.Recordset")

adoData.Open "SELECT pointtext FROM dbo_Script WHERE ScriptID = " & txtScript.Tag & " and PointID = " & Me.Controls(txtLabel & intPoint).Tag, Application.CurrentProject.Connection, adOpenStatic, adLockReadOnly

txtScript = adoData.Fields("pointtext")

adoData.Close

End Function
Another forum tells me to use something like
Code:
While {I can't remember the condition}
strMyData = strMydata & adoRS.fields(1).Getchunk
Wend
But I'm finding that a little too vague.

Is anyone able to provide some insight?

Thanks,

Cameron

URGENT***Reading V.Large Text Files****
I am trying to query text files with 280,000 records. Each record has 4 tabbed fields, and I need to query on field 1. I don't know how to do this in VB. Help Appreciated.
Thanks in advance.
Bob

Problem Reading End Of Large File
Hello, I'm trying to read the last 10000 bytes of a file. This works fine if a file is less than 2GB. If the file is bigger than 2GB, then I get a Run-time error '63' - Bad record number on the line: Get #1, FilePos, Buffer

It probably has something to do with the limit of a Long, but I'm not sure.



Code:
Dim FilePos As Long, strFilePath As String
Dim Buffer() As Byte

ReDim Preserve Buffer(10000)

Open strFilePath For Binary As #1
FilePos = LOF(1) - 10000
Get #1, FilePos, Buffer 'This line is causing the error when the file is bigger than 2GB.
Close #1

Reading Large File As Binary
Got a question about reading a large file and that is broken into 2816 byte records. I can open the file and get the information for the first 2816 bytes but I get no data for the rest of the file.
I dont know what I am doing wrong. Someone please let me know. Thanks


Using code below.

Dim strtext As String
Dim ft As Integer
Dim Y(2186) As Byte
Dim FILENAME2 As String
Open FILENAME For Binary Access Read Shared As #ft

Do While Not EOF(ft)


Get #ft, , Y
strtext = StrConv(Y, vbUnicode)
SerialNumber = Left(strtext, 7)



Loop

Close #ft

How Do I Improve Windows Responsiveness While Reading Large File?
I have a GUI that is used to select a data file and a text file. Once setup a pushbutton initiates a process that reads and process a very large file and runs to completion. While the program is processing, the Windows Desktop thread is pretty much locked. How can I keep the Desktop responsive to user input while the process is running.

Thanks for the assistance,

Lp

Reading/Writing Large Ammounts Of Data To A Single File...
Okay... I need to find a way to write and read a series of multilined data into a single text file.

Example:
Say I have 3 Multilined Text Fields.

Text1.text = "BLAH BLAH BLAH
NEXT LINE OF TEXT1.TEXT

A LITTLE MORE STUFF
And there..."


Text2.text = "BLAH BLAH BLAH
NEXT LINE OF TEXT2.TEXT

A LITTLE MORE STUFF
And there..."


Text3.text = "BLAH BLAH BLAH
NEXT LINE OF TEXT3.TEXT

A LITTLE MORE STUFF
And there..."


If I save them into a text file using the standard open X as output etc... I can save them all there, and the data is listed like so in the text file.

Contents of 'Text.txt'

BLAH BLAH BLAH
NEXT LINE OF TEXT1.TEXT

A LITTLE MORE STUFF
And there...
BLAH BLAH BLAH
NEXT LINE OF TEXT2.TEXT

A LITTLE MORE STUFF
And there...
BLAH BLAH BLAH
NEXT LINE OF TEXT3.TEXT

A LITTLE MORE STUFF
And there...




I need to know then how to load the text I stored using text1.text into text4.text or anything else. I can open the file, and load all the contents of the file into a text field, but I dont want to load it all, just that contents that was saved from text2.text or text1.text...

I need to know a new way of saving data into a text file to make it possible to load it the way I need, as well as the loading method to load it from.

I can not load the code line for line, because the code will be different on each line, and will never be the same. I need a way to tell it that when I want it to load what was saved in text2.text it can go the the text file, and find the correct lines and retrieve only that, and nothing more.

I await anyones reply to help out...

-Thanks

Very Large Text File
What control would you suggest loading the entire text file (5mb +) into so the user can scroll through the file and view it unedited? (As read only)

Im using a listbox, but it takes awhile for it to load, any suggestions?

I would like to have the user be able to scroll through the data using their scroll wheel on the mouse, how do I implement that?

Lastly, how would I make a progress bar to show how far through the text file the program is? I was thinking I could go through the file first, have it count the number of lines, then just use simple VB graphics to fill up the bar based upon how many lines its gone through so far. Is there an easier way of doing this?

LArge Text File
I am opening a txt file and filtering out un wanted spaces. The file is approx 350 mb.

The program is hanging on the 1st line input statement. It is hung now or I would copy cut and paste the code. Why is that? Any suggestions on getting around this problem?

The code is something like this:

Open FileName for input as #1
Open OutputFileName for output as #2
While not eof(1)
line Input #1, strInput
' Filtering code here

wend
Close #2
Close #1

Thanks
LJ

2D Strings Compare Large Text File With Dat File
Hi
i am trying to compare a search a large server.log for listings stored in a dat file
one by one.
so

dat file listing like this

mr a
mr b
mr c

then look in the server log file line by line for mr a, mr b and then mr c then if say at line 20 a hit on mr c is found stop, perform a task then resume the search till the next hit or till the end of the log

also as the server log is constantly updated i want a way to remember last postition and only scan the new additions to the log not the whole thing over and over

not asking for some one to hand it to me on a plate as i want to learn this as i go but allmost idiot proof examples of code would be very much welcome

thanks again

Edit A Very Large Text File
Dear Guys,

I have a problem with a massive text file which has the following format:

xxxxxxxxx
xxxxxxxxx
xxxxxxx">
cccccccc
xxxxxxxxx
xxxxxxxxx
xxxxxxx">
cccccccc
xxxxxxxxx
xxxxxxxxx
xxxxxxx">
cccccccc


Basically I want this to end up being:

xxxxxxxxx
xxxxxxxxx
xxxxxxx">cccccccc
xxxxxxxxx
xxxxxxxxx
xxxxxxx">cccccccc

etc....

So every time there is a "> it should move the line after that right next to it using the delete or removing the line feed.

Please help as I havent used VB in quite a while and need help.

Thanks and Regards

Large Text File Import
I hope someone can help me with this: I have to import a text file (using a VBA code) which is more than 65536 rows long into Excel. Preferably, the macro has to split the text file in two and devide them over two worksheets. Any suggestions?

Slurp Large Text File!
How can I slurp a large text file (300Mb+) into a single variable. How can I make use of the variable length string's 2 Billion Characters?

Large Gaps In Text File
Hi, I have a basic program that writes records from text boxes to a file.

Each set of records start on a new line.

After I enter a couple of sets of data and check the text file I find that there is large gaps at the begging of each new line.

Could someone please look through my code to see if they can find why it is doing this?


vb Code:
Dim LineCount As Long, DataLine As String  Option Explicit Private Type NoteRecord    StaffID As String * 4    Title As String * 4    Fname As String * 20    Sname As String * 20    DOB As String * 10    Address As String * 50    Town As String * 50    PCode As String * 7    HPhone As String * 12    MPhone As String * 11    Email As String * 50    JStatus As String * 8    AType As String * 9    APassword As String * 50       End Type Private Sub cmdcreate_Click()Dim i As IntegerDim file_name As StringDim fnum As IntegerDim note_record As NoteRecordDim value As StringDim l As Integer  Screen.MousePointer = 11 ' hour glass l = lblgetline + 1       ' Open the data file.file_name = App.Path    If Right$(file_name, 1) <> "" Then file_name = file_name & ""    file_name = file_name & "accounts.txt"    fnum = FreeFile    Open file_name For Random As fnum Len = Len(note_record)    ' Save the records.                    For i = l To l        note_record.StaffID = Trim(txtStaffID.Text)        note_record.Title = Trim(cmbtitle.Text)        note_record.Fname = Trim(txtfirstname.Text)        note_record.Sname = Trim(txtsecondname.Text)        note_record.DOB = Trim(cmbday.Text & "/" & cmbmonth.Text & "/" & cmbyear.Text)        note_record.Address = Trim(txtaddress.Text)        note_record.Town = Trim(txttown.Text)        note_record.PCode = Trim(txtpostcode.Text)        note_record.HPhone = Trim(txthomephone.Text)        note_record.MPhone = Trim(txtmobilephone.Text)        note_record.Email = Trim(txtemail.Text)        note_record.JStatus = Trim(cmbjobstatus.Text)        note_record.AType = Trim(cmbaccounttype.Text)        note_record.APassword = Trim(txtpassword.Text) & vbCrLf        Put #fnum, i + 1, note_record      Next i        ' Close the file.    Close #fnum    Screen.MousePointer = 0 CreateStaff.Hide      End Sub Private Sub Form_Load() 'see how many lines are in the file to see where to put nextOpen App.Path & "/accounts.txt" For Input As #1Do Until EOF(1)    Line Input #1, DataLine    LineCount = LineCount + 1Looplblgetline.Caption = Str$(LineCount) Close  'adds user types to list boxcmbaccounttype.AddItem "Admin"cmbaccounttype.AddItem "Reception"cmbaccounttype.AddItem "Maid"cmbaccounttype.AddItem "Caretaker"  End Sub


Thanks

Sorting A Large Text File
Hi, I have a text file with about 80,000 lines and I need to convert it to an other format. Converting is not a problem, but I have no idea how to sort the new text file in alphabetical order. A Listbox and Listview can't hold so many lines.

Thanks.

Sort Large Text File
Hello All

I am trying to do a sort on a very larger text file, approx 75 MB. I have implemented the code below, but I am having a problem copying the file at the end of the run, I get a 75 file access error. Is there a reason why I cannot copy the file even though I closed both of them?

By the way is there a better way of doing this beside a bubble sort?

Thanks Steve


VB Code:
Private Sub ProcessFile()Dim SortComplete As BooleanDim BeginRead As BooleanDim SrcFileNum As IntegerDim SrcFilePath As StringDim DesFileNum As IntegerDim DesFilePath As StringDim SrcString1 As StringDim SrcString2 As StringDim i As LongDim j As Long        Do While SortComplete = False                SrcFilePath = "c:Combined.txt"        SrcFileNum = FreeFile        Open SrcFilePath For Input As SrcFileNum            SrcFilePath = "C: emp.txt"        DesFileNum = FreeFile        Open SrcFilePath For Output As DesFileNum                j = j + 1        SortComplete = True        BeginRead = True        Do While Not EOF(1)            DoEvents            If BeginRead = True Then                Line Input #SrcFileNum, SrcString1                Line Input #SrcFileNum, SrcString2            Else                Line Input #SrcFileNum, SrcString2            End If                        BeginRead = False                        If SrcString1 < SrcString2 Then                Print #DesFileNum, SrcString1                SrcString1 = SrcString2            Else                Print #DesFileNum, SrcString2                SortComplete = False            End If            i = i + 1            If i Mod 1000 = 0 Then Debug.Print "Run: " & j & ", Line: " & i        Loop        Print #DesFileNum, SrcString1                Close #SrcFileNum        Close #DesFileNum                DoEvents                FileCopy DesFilePath, SrcFilePath     Loop End Sub

Very Large Text File Manipulation
I have a SQL script that I am including in my instalation that will create the database for our app.

In VB 6, I have a dialog that would allow the user to choose the name of hte database, server, etc.... and create the database, and then create configuration files.


However, the database script is roughly 30,000 lines. The VB app does not like me using an "Open" or a file scripting object call. It freezes up the computer. The code is correct though, when I use a smaller file ( 3000 or less lines) I have no real slow down whatsoever.


Any ideas?

Thanks!

-Jason

TextEditor For Large Text File
Anybody can point out a good Texteditor for a large text file, saying 30 mb?

Large Text File Parsing
I am using


PHP Code:





 Dim varText 

Searching In A Large Text File
Hello, I'd like to search for movie names in a large text file and return the matches. I know how to do it with predefined words, but what I'd like to do now is more complicated.

This is the code I normally use with predefined words.


Code:
Private Sub Command1_Click()
Dim sLines As String

Open "C:movielist.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, sLines
If InStr(1, sLines, "matrix") And InStr(1, sLines, "revolutions") Then
Text1.Text = Text1.Text & sLines & vbCrLf
End If
DoEvents
Loop
Close #1

End Sub


Now I have this in a textbox:


Code:
!search matrix revolutions final end


If "!search" is in the textbox, then the other words (excluding "!search") need to be used as search strings, but only if they are at least 4 characters. In this case "matrix", "revolutions" and "final".

I know I can find out if "!search" is in the textbox with the Left function and that I have to put the words in an array, but how do I only add the words with at least 4 characters to the array and how do I use the array to search in the text file?


Code:
Private Sub Command2_Click()
Dim strArray() As String

If Left(Text2.Text, 8) = "!search " Then

strArray = Split(Text2.Text, " ")

End If

End Sub

Finding Text In A Large File
Is there a way to find text within a large file (several megabytes)? I'm trying to find out if a chm file contains a topic, and it looks like the topics are listed at the top. Alternatively, if there is something that allows me to find this out, rather than open a dialog with "page not found" displayed, that would work to solve my problem.
Thanks in advance.

Displaying A Large Text File
I want to read a large text file and display it as a wordpad. How can I do this. I tried to display my file using notepad but it displays only part of it. I suspect this is due to a limitation in notepad. Any sample code would be much appreciated

Thanks in advance

Deepal

Large Text File Editor
At my job I need to view files to verify that the data is not corrupt, some of these files are very large(4 gigs or more sometimes) and I am limited to 2 gigs with text editors such as SlickEdit, etc. My first option was to find a suitable editor on the internet, but every one that I downloaded had a similar limitation, and the ones that were supposedly unlimited file size tried to load the whole file into memory, which doesn't work. So now I am thinking I will have to write my own editor that will only load portions at a time, view that portion, then load another portion and unload the previous. I would like to update the line count for each portion of the file. I only have a little over a year's experience programming, so I am not sure if this is out of my league. If any of you could steer me in the right direction, pertaining to how to only load a portion of the file into memory(I think VB has a 2 gig limit, so this will have to be done) I would greatly appreciate it.
Sean

Import Large Text File To Excel?
Hello, Everyone:
I would like to input a text file to my Excle data sheet. It has more than one line and I want to the excel sheet has 32 column with each row. How can I do it manually and in VBA also?
Thank you very much!
Charlie

Speeding Up A Text Search For A Large File
i have text files between ~8M and 40M ranging from ~5000 lines to 50000 lines, with 9 'columns' of data (8 tabs per line)

using most of the search code i have, if the number of results returned is small (500 or less) the search goes fairly quickly. 10, maybe 20 seconds (win XP, 2gb cpu, etc)

but if the search is to return 4000 records i'll be waiting for 4 min or so. and all the data is right here on my PC. that just seems way too slow. there must be a much faster way to dig into a large file and, before you can blink, it returns the results, no matter how many there are

it seems the issue is not the number of lines that slows the search down, but the number of results returned.

hopefully there is a way to do this.

Problem When Open Large Text File
i make a programe which open text file then replace each char. in it with another char.
i but the text i open in a String >>>all are right but the problem appear when i open a large text file(more that 3000 lines) then i press the button to do the process but no result appear in the textbox >>>
while if i open text file which have for expmle 1000 lines the programe work very good>>>>
where is the problem>>>>>>

Handle Large Text File Superfast
Hi all,

I have a large text file like 50000 lines (minimum). My program reads this file and do some modification in each line and write it to another text file.

That's what I do?

Normally if the text file has only 100 lines then it takes only 2 seconds to process it. But if the file is large then it takes even 10 seconds to process each 100 lines.

How to fix this issues? I need to keep the process time as 2 seconds for each 100 lines for any number of lines.

show me the best way to do this.

Thanks in advance.

Display Large Text File In Textbox
hello all

I have to open and display a selected portion of large file (more than 64K) but I'm getting problem when using textbox or richtextbox. The program always hang when using this method.

Any other solution?

Thanks.

Best Way To Read A Large Text File Quickly
I'm still a fairly novice VB programmer, but i've been knocking up some bits and bobs to teach myself.

I've written a random URL generator that picks a random word from a large text file and opens up a basic web browser window to see if it turns out to be an actual site.

The problem is that the text file containing the random words is 180,000 lines long and takes forever to read as I choose a line at random and read the file line by line until i get to the chosen word.

Is there a quicker way to read it ?.

I want to be able to continually add words to the text file y'see, so i can't really create an array in the program as it would defeat the object of adding to the file.

Any clues would be most welcome .. thanks ..

Import Large Text File To Access Db
I have a large text File (more than 20Mb) and I can import it easly in a Ms-Access Db using the below codes. But the progress is slow (it takes more then 4 minutes) and I am looking for fastern procedures. I will appreciate if any body help me.
Thanks


Code

Sub ImportTxt()

    Dim proddb1 As Database
    Dim MyRs As Recordset
    Dim f As Integer
    Dim MyStr(21) As String
    Dim MyFld As String

    Set proddb1 = OpenDatabase("e: empdbtmp.mdb")
    Set MyRs = proddb1.OpenRecordset("select * from datasheet", dbOpenDynaset)
    For j = 0 To MyRs.Fields.Count - 1
     MyFld = MyFld + "," + MyRs.Fields(j).Name
    Next j
    MyFld = Right(MyFld, Len(MyFld) - 1)
    MyRs.Close

    f = FreeFile
    counter = 0
    Open "e: emp10-2.mgd" For Input As f

    Do While Not EOF(f)
        Input #f, MyStr(1), MyStr(2), MyStr(3), MyStr(4), MyStr(5), MyStr(6), MyStr(7), MyStr(8), _
        MyStr(9), MyStr(10), MyStr(11), MyStr(12), MyStr(13), MyStr(14), MyStr(15), MyStr(16), _
        MyStr(17), MyStr(18), MyStr(19), MyStr(20), MyStr(21)
        StrValues = ""
        For i = 1 To 21
         StrValues = StrValues + "," + Chr$(34) + MyStr(i) + Chr$(34)
        Next i
        StrValues = "10-2" + StrValues

        strSQL = "INSERT INTO datasheet (" & MyFld & ") "
        strSQL = strSQL & "VALUES(" & StrValues & ") "

        proddb1.Execute strSQL
        counter = counter + 1
    Loop
    MsgBox counter & " Records Imported"
    Close #f
    proddb1.Close
End Sub

Problem With Compare Two Large Text File
I am wondering is there a way or different method to compare two large text file without taking up so much time. I tried the FC.exe command and it did it very fast, but when I try to compare it in my VB program, it takes forever to finish with following code.

open FN1 for input as #1
while not eof(1)
line input #1, Str1
open FN2 for input as #2
do while not eof(2)
line input #2, Str2
if (Str1 = Str2) then
bfound = true
exit do
end if
loop
wend

Thanks you in advance

Sorting Large Number Of Large Text Files
Hi,
I have around 500 text files (csv format). Each file is ca. 5MB and sorted by a timestamp. my application needs to playback all these files line by line but sorted by time.my goal is not to put all files in memory, use a sorting algorithm, create one sorted output file and then read from the output file.
I am rather thinking of sorting the files as they stream. For this I would only need to know in each file the time stamps of the current lines and compare them to each other.
what is the best way to do this? any ideas?
thanks

Sorting A Large Text File ..... Waves To Hack :)
Based on the other thread with the same name which is marked as reolved ...

I'm now using this Quicksort routine to sort a text file thats nearly 2 meg in size.
It contains fixed length records.
I towkred before, but now the file is bigger I am getting "Input Past End Of File" error messages on the line of code highlighted below.
Anyone know why ?


VB Code:
' Now sort file into alphabetical order    Open "C:att_value.txt" For Input As #1     [b]str1 = Split(Input$(LOF(1), 1), vbCrLf)[/b]    Close #1        QuickSort str1, LBound(str1), UBound(str1)        Open "C:att_value.txt" For Output As #1     Print #1, Join(str1, vbCrLf)    Close #1

Splitting A Large Text File... Or Searching Contents?
Hi all. I've been beating down the search function attempting to find the cleanest (and more importantly, easiest) method to read a large text file with a few hundred records and multiple fields per record.

I had originally decided to type in the first field (name), then execute a search through the records till the name was found, then assign variables to each field of that particular record. Now, I think I'm switching to a combo box drag-down list that displays only the first field of each record. My problem comes in sucking in all that information for the combo box, while still maintaining the variables for the other fields.

Let me give an example:

(Contents of my text file)
Bob Ward,15,BobWard.wav
John Thompson,31,JohnThompson.wav
Steve Kirk,16,SteveKirk.wav
Heather Sparks, 15,HeatherSparks.wav

Initially, I would have typed "Bob Ward" in, and search for an instance of that name in the text file. If Bob Ward wasn't found, the program would simply move to the next step. (This will happen throughout). Now that I'm typing this, it seems like that may be the way to go anyhow- as any record NOT found in a Combo Box I'll need to add anyhow... and that will require more coding.

Regardless, I was planning on pulling in the data, splitting it by vbCrLf into one group (records) and splitting it by comma for the other group (fields). In fact, I've already done this on a much smaller scale 12 record .txt file, and it works perfectly. However, with the much larger file, that would require a lot more lines of code the method I used... not an impossible task, but it would require more coding if I even decided to add more records. (I wasn't doing for I.. next I, rather just naming record1-12 as seperate arrays)

This post may be confusing, but I've been trying to structure my thinking so as not to waste coding time later. Any advice at all will be appreciated, and I am by no means a VB professional, rather just a hacking amateur.

Thanks in advance!

Importing A Very Large Text File In A String Variable
Hello friends...

I'm having an urgent problem here; I'm trying to import a very large text file of +54 MB(!!) into a String variable but each time the machine crashes...

Does anyone know what the problem is? Normally seen a string variable can contain up to 2 billion characters (says the VB Help)...

PS. It works fine with large files of 10 to 20 MB.
PPS. The machines who need to process those files are Pentium III's with 128 MB internal memory...

Here's the code I use in my program:

====================================

Public Function ImportFile(iMessage As Integer, Optional ByVal fLatestFile As Boolean = False, _
Optional strFileName As String) As String

Open sFileName For Input As #1
ImportFile = Input(lLength, #1) -> Crash!
Close

====================================

lLength contains a value like this = 55000000

Is it crashing because of a memory-overflow?

Please help Me if You know a solution for this...

Thank You

Bart

How To Read A Large Amount Of Plain Text Into An Application From A File?
Hi,

I have the user click on a number of labels which are all in a control array whatis(). When a user clicks on a label, I want the appropriate and corresponding file to be opened and read into the memory a few bytes at a time.

My current code is as follows, (the array means I don't have to have a different file open function for every label.

My problems are described below the code


VB Code:
Option ExplicitDim helpfilename(20) As String Public Sub whatis_click(index As Integer)Dim helpno As Integer helpfilename(0) = "whatdoesthisdo.txt"helpfilename(1) = "whomadethis.txt"helpfilename(2) = "whatisencryption.txt"helpfilename(4) = "whatisdecryption.txt"helpfilename(5) = "howdoesitwork.txt"helpfilename(6) = "howsecureisit.txt"helpfilename(7) = "useitfor.txt"helpfilename(8) = "discloseinfo.txt"helpfilename(10) = "legalegit.txt"helpfilename(11) = "upgrade.txt"helpfilename(13) = "modifyprog.txt"helpfilename(14) = "troubleshooter.txt"helpfilename(16) = "howdoiuse.txt"helpfilename(17) = "faq.txt"'Code here to read in an appropriate text file a few bytes at a timeEnd Sub


The index is of course the index of the label within the control array. Each index number in the array above corresponds to the file that should be opened for the index number of the label that was clicked in the control array.

What would be the best way to:
Read the corresponding file into memory without overflowing the memory or the variableRead it in only a few bytes at a time (each text file is a large passage of text equating to around 2kb to 10kb).

Many thanks,

Jord

Problem Retrieving Large Text Data From The Excel File
Hi
I am trying to retrievd data from the excel file using ADO and updating the SQL aerver based on that.
My problem is that the code is giving error for any column which has a large text data.
Please help me what i need to do.
the connection that i am establishing is as:

cn.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & _
Trim(strFilePath) & Trim(strFileName) & _
";Extended Properties='Excel 8.0;IMEX=1;FMT=Delimited;HDR=Yes;MaxBufferSize=2048;PageTimeout=5'"


cn.Open

rs.CursorType = adOpenDynamic
rs.CursorLocation = adUseClient

Reading Text File And Rename File Listed In Text File
Great boards, been browsing for a while but this is my first post.

I'm trying to read from a CSV text file and then renaming an image from said text file.

2 fields in the text file will be used and cycled through, 1 field is an image number: mcc_001.jpg and 1 field will be the new name: 056950-000-002700-00000-2A20051201.JPG

I'm stuck where to start, any help would be greatly appreciated.

Thanks!

Convert Large Binary Files (3270 Exports) To Text File Format.
Access XP doesn't appear to import Binary files when exported directly from Attachmate.
Some of these files are quite large 18mb - to 100mb.

When I attempt to open the files in Access XP they fail and lockup Access XP. I have looked at the file format with some Hex compare utilities and they report that the file is 'Binary'.

If I take the same exact file and open it in Notepad then click save the file date and time changes and the file works perfectly with Access XP. (And the HEX compare utility no longer indicates that the file is binary)

Now that I am aware of this limitation - How do I take the file called XYZOutput.txt - open it in VB with FSO and write it back out as the same file name?

My theory was - If I can open the file in notepad - make NO CHANGES - but click 'SAVE' - the file structure changes from binary to text.

I have the following code to open the file and close it - but in VB it does not change the structure the way notepad.exe did?

One catch - the routine needs to handle large files, and since they are large I don't want to make a second file. I don't know what the file size limitation is of Notepad.exe. I want to fix the broken file. So for example - If my file is called "XYZOutput.txt" I want the VB routine to open this large file 'fix the formatting from binary to text' and save it.

'' Code ----------------------------------

    Dim fso As FileSystemObject
    Dim fil As File
    Dim ts As TextStream

    Set fso = CreateObject("scripting.filesystemobject")
    Set fil = fso.GetFile(sourcefile)
    Set ts = fil.OpenAsTextStream(ForAppending)
    ts.Close
    Set fso = Nothing
      
Kramerica

Text File Editing/reading.... Specific Text
ok, so heres what i want to do...

i have a text file...


inst
200, ind_land101, 873.302, -201.607, 3.75377, 1, 1, 1, 0, 0, 0, 1
201, ind_land053, 969.677, 58.1152, 1.47774, 1, 1, 1, 0, 0, 0, 1
202, ind_land041, 865.099, -142.541, -1.06795, 1, 1, 1, 0, 0, 0, 1
203, ind_land014, 976.606, -131.993, 2.58558, 1, 1, 1, 0, 0, 0, 1
204, ind_land010, 979.771, -127.777, 2.14238, 1, 1, 1, 0, 0, 0, 1
205, ind_land029, 785.099, -213.823, 1.06328, 1, 1, 1, 0, 0, 0, 1
...
...
end
cull
end
pick
end

so i want to start filling the array after the "inst"
and i want up to the second "," comma.

e.g.

200, ind_land101
201, ind_land053

and so on.. in one array,

then in another array i want

873.302, -201.607, 3.75377
969.677, 58.1152, 1.47774

and so on...

i have tried the input, which reads to commas, but i could never get it to start reading after the "inst"


thanks in advance...

Advice Sought - Using A DB To Store File Contents Vs Reading Text File Straight Into VB
Hello -

I have an approx 300 line comma separated and hierachically arranged text file and am currently duplicating the comma separated bits into various Access database tables and reading it into VB from there. I'm not too keen on duplicating the info and am looking for a neat way to either parse the original file straight into my VB GUI's memory space or some how tokenise the file. I know that this can be done with lex/yacc and c++ and am wondering what the best VB route to go down would be.

Any advice would be gratefully received!!!
Thanks,
Mairi

Really Need Help: Reading Large Log Files In VB
Hi, I'm sorry if this is very dumb, but I'm not a VB programmer, I usually code in ASP for the web, but now I need to write a VB application. This is what I'm trying to do:

I have many mail log files ranging from 3-50 megs in size. I need to read through them and get the following data:
date, domain, number sent, number received
bytes sent, bytes received, total bytes

I am using a reg exp to parse the strings, which works quite well, but I have trouble reading big files. My app hangs and CPU time goes up to 100%. My goal eventually is to parse each file, then store all the data in an access db, but I don't know if it's the most efficient way of merging data. I would love some input on that as well, but my main question is how do I read in a large text file. I looked at binary read, and I don't get how to work it. I get the idea of allocating a buffer but I don't really get how to do it. So I would really appreciate is someone could post an example of a function to read large text files with a buffer, or maybe reading it chunk by chunk. I would really appreciate an explanation of what exactly will this function return (ex: if it's an array what does each element of it holds). I REALLY REALLY APPRECIATE ANY HELP!

Thanks a lot in advance!

-- Greg

Really Need Help: Reading Large Log Files In VB
Hi, I'm sorry if this is very dumb, but I'm not a VB programmer, I usually code in ASP for the web, but now I need to write a VB application. This is what I'm trying to do:

I have many mail log files ranging from 3-50 megs in size. I need to read through them and get the following data:
date, domain, number sent, number received
bytes sent, bytes received, total bytes

I am using a reg exp to parse the strings, which works quite well, but I have trouble reading big files. My app hangs and CPU time goes up to 100%. My goal eventually is to parse each file, then store all the data in an access db, but I don't know if it's the most efficient way of merging data. I would love some input on that as well, but my main question is how do I read in a large text file. I looked at binary read, and I don't get how to work it. I get the idea of allocating a buffer but I don't really get how to do it. So I would really appreciate is someone could post an example of a function to read large text files with a buffer, or maybe reading it chunk by chunk. I would really appreciate an explanation of what exactly will this function return (ex: if it's an array what does each element of it holds). I REALLY REALLY APPRECIATE ANY HELP!

Thanks a lot in advance!

-- Greg

Reading Large Files
Im creating a simple server for my pc to send and receive data from other pcs. The only problem i am having is it will not read files larger then 1 k. I really need it to read up to 3meg files into a sting. Heres my code. It always comes back with the error "input past end of file".

Function Get_Text(FileName2 As String) As String
dim F as long
F = FreeFile
Open FileName2 For Input As #F
Get_Text = Input$(LOF(F) + 1, #F)
Close F
End Function

Reading Specified Format Text From Text File
I have below Sample text. I need find in the text specfice Key name its Value(HKEY_CURRENT_USERControl PanelInternational), If I find this I need to go inside of this and read Value 0 (Name: Its value and Data: Its value),Value 1 (Name: Its value and Data: Its value)....Value N (Name: Its value and Data: Its value).

Please provide me same code for this. forum leader help on this

Sample
-------
Key Name: HKEY_CURRENT_USERControl PanelInput MethodHot Keys0000202
Class Name: <NO CLASS>
Last Write Time: 8/7/2006 - 7:07 PM
Value 0
Name: Key Modifiers
Type: REG_BINARY
Data:
00000000 03 c0 00 00 .À..
Value 1
Name: Target IME
Type: REG_BINARY
Data:
00000000 00 00 00 00 ....
Value 2
Name: Virtual Key
Type: REG_BINARY
Data:
00000000 4c 00 00 00 L...

Key Name: HKEY_CURRENT_USERControl PanelInternational
Class Name: <NO CLASS>
Last Write Time: 8/7/2006 - 7:07 PM
Value 0
Name: iCountry
Type: REG_SZ
Data: 1
Value 1
Name: iCurrDigits
Type: REG_SZ
Data: 2
Value 2
Name: iCurrency
Type: REG_SZ
Data: 0
Value 3
Name: iDate
Type: REG_SZ
Data: 0
Value 4
Name: iDigits
Type: REG_SZ
Data: 2
.
.
.
Value N
Name: iLZero
Type: REG_SZ
Data: 1

Copyright © 2005-08 www.BigResource.com, All rights reserved