Path: utzoo!attcan!uunet!mcvax!hp4nl!dutrun!winfave From: winfave@dutrun.UUCP (Alexander Verbraeck) Newsgroups: comp.lang.pascal Subject: Re: TP5 and/or Programmer bug? Message-ID: <815@dutrun.UUCP> Date: 25 Jul 89 23:03:38 GMT References: <20351@adm.BRL.MIL> Reply-To: winfave@dutrun.UUCP (A.Verbraeck) Organization: Delft University of Technology, The Netherlands Lines: 79 In article <20351@adm.BRL.MIL> MUSIC01%UNIPAD.INFN.IT%ICINECA2.BITNET@cunyvm.cuny.edu writes: >We are developing a program in which we need to access (in different times) >a lot of disk files. We assign the disk file to the logical file, open it, >read it and close it. A LOT of times. Unfortunatly, after 20-30 accesses, >we obtain a 'TOO MANY OPEN FILES' runtime message. I'm SURE that the program >does exactly what I told you. >Any suggestion? I tried opening a lot of files with Turbo Pascal 5.0 (source code included below) without any problems at all. Which DOS version are you using (that could be the problem)? It is also possible that you have more files open on the same time. Could you e-mail me the critical part of the program so that I could look into it? Any net readers using Turbo Pascal 5.0 having problems with the program below? One file is open at the same time. 51 file buffers are reserved. ------------------------------------------------------------------------ program TestManyFiles(input,output); uses Dos, Crt; var f : text; g : array[1..50] of text; i : integer; s : string; begin ClrScr; for i:=1 to 100 do begin assign(f,'TESTMANY.PAS'); reset(f); write(i:4); close(f); end; writeln; writeln; for i:=1 to 50 do begin assign(g[i],'TESTMANY.PAS'); reset(g[i]); write(i:4); close(g[i]); end; writeln; writeln; for i:=1 to 50 do begin assign(f,Chr(65+i mod 25)+Chr(65+i div 25)+'.BAK'); rewrite(f); writeln(f,i:5); write(i:4); close(f); end; writeln; writeln; for i:=1 to 50 do begin assign(g[i],Chr(65+i mod 25)+Chr(65+i div 25)+'.BAK'); reset(g[i]); readln(g[i],s); write(i:4); close(g[i]); end; writeln; repeat until KeyPressed; end. --------------------------------------------------------------------- Alexander Verbraeck e-mail: Delft University of Technology winfave@hdetud1.bitnet Department of Information Systems winfave@dutrun.uucp PO Box 356, 2600 AJ The Netherlands ---------------------------------------------------------------------