PDA

View Full Version : Reading large text files



jwarrent
02-15-2004, 05:58 PM
I'm having troubles reading really large text files in order to search through them and grab specific information from them. My code works great until the text file reaches about 2MB + in file size, and then it errors out saying I'm trying to read a table that has a nil value. I'm using TextFile.ReadToTable to access the text file. Is this a known issue or is there a possible work-around for my problem?

Specifically what I am doing is creating a utility that grabs a list of text-based files used to generate 3D objects, reads through each of those text files looking for any textures used, then compares them to a directory list of texture files. It then spits out any textures that aren't used allowing me to quickly get rid of content I don't need that may have built up over many months.

For my purpose, I only need to read through the first 20% of each file, but I can't seem to find any commands that would let me read a text file line by line without loading the entire file or anything similar. I'm open to suggestions in general or if anyone can point me to a solution to the apparent limit on file sizes.

Thanks in advance!

jesse