MUSIC01%UNIPAD.INFN.IT%ICINECA2.BITNET@cunyvm.cuny.edu (07/25/89)
Hi, everybody. I have a new exciting problem for you! 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? Thanks in advance.... Andrea.
winfave@dutrun.UUCP (Alexander Verbraeck) (07/26/89)
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 ---------------------------------------------------------------------
boc@druhi.ATT.COM (Ocinneide) (07/28/89)
In article <20351@adm.BRL.MIL>, MUSIC01%UNIPAD.INFN.IT%ICINECA2.BITNET@cunyvm.cuny.edu writes: > we obtain a 'TOO MANY OPEN FILES' runtime message. I'm SURE that the program > does exactly what I told you. > Any suggestion? > > Thanks in advance.... You do not appear to be closing the files properly, and are running out of file buffers. If you need many files open at one time you can set the number of file buffers available to the system in CONFIG.SYS by 'FILES = n" (or is it 'BUFFERS = n'?) where n is the maximum number of files to be open at one time. Any DOS reference should be able to help. Breanndan