Path: utzoo!attcan!uunet!snorkelwacker!usc!ucsd!nprdc!malloy From: malloy@nprdc.arpa (Sean Malloy) Newsgroups: comp.sys.ibm.pc Subject: Re: Retrieving the value of FILES=??? Keywords: Global File Handle Table Message-ID: <7921@skinner.nprdc.arpa> Date: 14 Jun 90 21:42:52 GMT References: <605@digigw.digital.co.jp> <4057@jato.Jpl.Nasa.Gov> Reply-To: malloy@nprdc.arpa (Sean Malloy) Organization: Navy Personnel R&D Center, San Diego Lines: 42 In article <4057@jato.Jpl.Nasa.Gov> kaleb@mars.UUCP (Kaleb Keithley) writes: >How about: (in psuedo-code) >#ifdef DOS > fopen ("/CONFIG.SYS", "r"); > fscanf (..., "FILES=", ...); > fscanf (..., value, ...); > fclose (...); >#else > other method appropriate for architecture >#end > >Since all DOS machines have to have CONFIG.SYS in the root directory, it >would work for any DOS box. If the fopen fails, then assume the default. Only if you are running a reasonably vanilla DOS system. My system has the following startup parameters: ===============CONFIG.SYS: BUFFERS=1 FILES=10 DEVICE=C:\QEMM\QEMM.SYS RAM EXCLUDE=C600-C7FF ===============AUTOEXEC.BAT: C:\QEMM\LOADHI BUFFERS+39 C:\QEMM\LOADHI FILES+30 Your example will not, then, work for _my_ DOS box, returning '10' when there are really 40 file handles. Additionally, opening "/CONFIG.SYS" only works if you are running the program from your boot drive. My system has A-H as valid drives; if I try to open "/CONFIG.SYS" on G:, I'm going to get a null file pointer back from fopen(). | "The three most dangerous Sean Malloy | things in the world are a Navy Personnel Research & Development Center | programmer with a soldering San Diego, CA 92152-6800 | iron, a hardware type with a malloy@nprdc.navy.mil | program patch, and a user | with an idea."