TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Paul Edwards
from: Mario Semo
date: 1996-10-07 11:27:04
subject: file handles

Hello Paul,

On Oct 01 20:58 96, Paul Edwards of 3:711/934.9 wrote:

 PE> With a 16-bit MSC 6.0 compiled program, I only appear to be 
 PE> able to open 14 files via fopen, even when I use "fh" (a 

yes. 

 PE> And can anyone suggest a fix?

just do what MS suggest to do. change the startup code. 



from \c600\readme.doc (mh - whatever READ ME means):

     Increasing File Handles

     To increase the number of file handles, edit the start-up source
     file CRT0DAT.ASM, which is provided in this release. Change the
     line

          _NFILE_ = 20

     so that _NFILE_ is set to the desired maximum. For example, to
     increase the maximum number of available file handles to 40,
     change the line as shown here:

          _NFILE_ = 40

     NOTE: Increasing the number of file handles allows you to use
           low-level I/O functions, such as open and read, with more
           files. However, it does not affect the number of
           stream-level I/O files (that is, the number of FILE *
           streams).


     Increasing Streams

     To increase the number of streams, edit the source file _FILE.C.
     Change the line

          #define _NFILE_ 20

     to set _NFILE_ to the desired maximum. For example, to allow a
     maximum of 40 streams, change the line as shown here:

          #define _NFILE_ 40

     Increasing the number of streams allows you to use stream-level
     I/O functions, such as fopen and fread, with more files.

     NOTE: The number of low-level file handles must be greater than
           or equal to the number of stream-level files. Thus, if you
           increase the value of _NFILE_ in the module _FILE.C, you
           must also increase the value of _NFILE_ in the module
           CRT0DAT.ASM.


     Increasing the System Limit

     To use more than 20 files at a time, you must increase the file
     limit imposed on your process by the operating system.

     To increase the system-wide limit, increase the number of files
     available on your system as a whole by editing your system
     configuration file (CONFIG.SYS). For example, to allow 100 open
     files at a time on your system, put this statement in the
     configuration file:

          FILES=120

     To increase the process-by-process limit, you must also increase
     the number of files the operating system makes available to your
     particular process. To do this, edit CRT0DAT.ASM and enable the
     commented-out code that is preceded by the appropriate
     description.

     In the DOS version of CRT0DAT.ASM, for example, the commented-out
     code appears as shown here:

          ;       mov     ah,67h
          ;       mov     bx,_NFILE_
          ;       callos

     In the OS/2 version of CRT0DAT.ASM, the code appears as a
     call to DOSSETMAXFH. Under OS/2, you must also enable the
     'extrn DOSSETMAXFH:far' declaration that appears near the
     beginning of the file.

     In either case, remove the semicolon (;) comment characters.

     NOTE: Under OS/2, you must take into account the fact that each
           process has the potential to "own" open files. When
           planning how many open files to allow on a system-wide
           basis, take this into account.


PS: i can't remember where you can find _file.c. i have it from MS-C6.0 CRT
source code. (which was a seperate product).

 WARPED!, Mario

--- Msgedsq/2 2.2e
* Origin: LC/32 Development Team-Vienna-Austria (2:310/14.11)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1
@PATH: 310/14 1 24/999 888 396/1 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.