Hello Mark,
 
>AssignFile(FileName, File);
>ReWrite(FileName);
>Write(FileName, 'Data');
 
I believe you meant something like:
 
var
    F : TextFile;
    FileName : String;
begin
 
AssignFile(F, FileName);
ReWrite(F);
Write(F, 'Data');
 
The answer, as far as I know, is you can't assign different files to the same variable and use them dynamically.
 
To solve a "one variable - many text files" problem I use threads.
 
The app I'm currently working on has to deal with potentially very large text files (up to a gig in size) and export them into Excel.
Excel can't handle such files, so my prog splits them into smaller ones before exporting.
 
Each thread uses the same procedures for writing/reading to/from text files and export operations.
I have text file variable set up as an attribute of a thread object. This way I can use it with different files because it's local to each thread.
A bit more tricky to program, but is quicker to run too.
 
Hope this helps.
 
Cheers,
Sergei Stenkov

Reply via email to