Page 1 of 1 1
Topic Options
#125832 - 2004-08-29 10:50 PM Processing multiple files
Anonymous
Unregistered


I have a need to open multiple files and grab certain info from each one. Each file would have the same extension and reside in the same directory. Doing what I need to with info is not a problem. My problem is, how do I handle the multiple files? I don't need to open more than one file at a time, but I don't want to open the same file more than once. It would be preferable to rename the file once I'm finished with it but I'm not sure how to keep track of them.

There could be 50 files in the directory or 500 and I would need to be able handle any number of files.

Top
#125833 - 2004-08-29 11:26 PM Re: Processing multiple files
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Use Dir() or one or the various DIR*() UDFs to read all the filenames into an array and then just go to town. I don't know where you need help. Basically you Open() a file, ReadLine() in the lines, and Close() it and move on to the next. KiX supports upto 10 file handles so you can have that many open at once if need be. There are also ReadFile*() UDFs that will read a file into an array.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.225 seconds in which 0.126 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org