-
November 16th, 2001, 02:31 AM
#1
large text file
hi there guru and all, i am working on a vb application to read data from text files. some of the files are okay to read but some of them are large size text files, when i run the application on the large text files i get an error stating out of memory....
is there a way that i can deal with this problem?
thank you for your time and attention, really appreciate it.
-
November 16th, 2001, 03:59 AM
#2
Re: large text file
You can use FileSystemObject for this purpose.
Look it up in MSDN.
Regards,
The Beret.
-
November 16th, 2001, 08:21 AM
#3
Re: large text file
Are you reading line by line ? If so then reduce the lenght of your read to a fixed number of characters.
Nicolas Bohemier
______________
Un sourire ne coûte rien, mais il rapporte beaucoup; il enrichit celui qui le reçoit sans appauvrir celui qui le donne.
Frank Irving Fletcher
Nicolas Bohemier
-
November 18th, 2001, 07:53 PM
#4
Re: large text file
the problem is that the file treats the whole content as one line, each line is represented as chr(10) in ascii (FYI,this file is extracted from a solaris machine). there are 2 file sizes. the first one can be read although it does not extract all the information where i can use the idea of breaking each chr(10) into a vbcrlf then adding it to the table one by one. the other one might be a problem because the file size is too large for the application to open.
I would like to use the FSO approach to open the file first but then again, i do not know how to define FSO so that it will create a file object for the large size file.
if you guys have any workarounds for this , really appreciate sharing it. thank you for all your time.
-
November 25th, 2001, 09:15 PM
#5
Re: large text file
hi, i am trying the FSO approach here is the snip of the code i'm using :
Dim fp as string
fp = File1.Path + "\" + File1.FileName
set fso = Server.CreateObject("Scripting.FileSystemObject")
set file = fso.opentextfile(fp, 1)
Do Until file.AtEndOfStream
Text1.Text = file.readall
Loop
set file = nothing
but when i run it, it prompts out object required, did i missed something?
-
November 26th, 2001, 05:54 AM
#6
Re: Another approach...
If text files are getting too large, it is time to switch to a database. You may use Access and Ado or Dao. But if you know nothing about, better start doing some exercise with Access and with small questions here and there..
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
November 26th, 2001, 09:20 PM
#7
Re: large text file
hi, i'm using your approach, although there are a few people ask me to look up on DAO or ADO. But i'm not going to use any access table for this matter. i have already included the microsoft scripting runtime option in the references. but it still prompts me that an object is required.
Dim fso as new FileSystemObject
set fso = Server.CreateObject("Scripting.FileSystemObject")
set file = fso.opentextfile(fp, 1)
and the error highlighted
set fso = Server.CreateObject("Scripting.FileSystemObject")
what could be the problem? really appreciate it.
-
November 26th, 2001, 09:39 PM
#8
Re: large text file
There is no need to put the following line :
set fso = Server.CreateObject("Scripting.FileSystemObject")
Since, you have already declared fso as New FileSystemObject.
Remove that line and it will start working.
Regards,
The Beret.
-
November 26th, 2001, 09:47 PM
#9
Re: large text file
hey guess what...you're right...! thanx....errmm however there seems to be a bit of problem and i was hoping maybe u could help me. you see the reason why i wanted to use FSO to read text files because there are some large text files involved so i though if i used FSO then it would solve it. After taking out the line out of the code, the FSo seems to be able to open the text file selected and display it to the text. the only problem is that when it came to the large text files, the same problem occurs which is out of memory. does FSO have a file size limit too?
appreciate your time and attention.
-
November 26th, 2001, 10:08 PM
#10
Re: large text file
Just how big is your text file?
And what exactly is the Out of Memory message that you get?
It would help if you post the code.
Regards,
The Beret.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|