Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - morehandles() enable opening up to 255 files at one time http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 morehandles()       Enable opening up to 255 files at one time
------------------------------------------------------------------------------
 Declaration
   file.hdr

 Syntax
   proc morehandles extern

 Arguments
   None.

 Return
   None.

 Description
   The morehandles() procedure enables a program to open up to 255 files at
   one time, regardless of DOS version. The open files may be of any type,
   e.g., database, index text, etc.

   morehandles() actually is a dummy procedure, i. e. it immediately returns,
   but when included in a program, the library module containing the
   morehandles() symbol gets linked in, thus adding code to the Force
   startup module for more handles. Therefore, morehandles() can be placed
   anywhere in the program code.

 Example
   #define EXAMPLE_FILE
   #include example.hdr

   // Place a call to morehandles() anywhere in a program if more than 15
   // files are necessary to open at once.
   
   #define NUM_FILES 20
   
   proc Test_morehandles
   vardef
      char   cName             // file name
      uint   n                 // counter
      _HFILE aFiles[ 100 ]     // array of file handles
   enddef
   if .f.           // it is not necessary that morehandles() is ever called
      morehandles() // but it must be referenced in the module
   endif
   ? "Creating..."
   for n := 0 to NUM_FILES
      cName := "test" + padl( istr( n ), 3, '0' )
      if fbopen( aFiles[ n ], cName, FB_CREATE )
         ? cName
      endif
   next
   ?
   ? "Deleting..."
   for n := 0 to NUM_FILES
      fbclose( aFiles[ n ] )
      cName := "test" + padl( istr( n ), 3, '0' )
      ? cName
      erase cName
   next
   endproc

   proc main
   Test_morehandles()
   endproc

See Also: fbopen() fopen() mopen() open

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson