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 - curdrive() return the current dos drive in numeric format http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 curdrive()          Return the current DOS drive in numeric format
------------------------------------------------------------------------------
 Declaration
   file.hdr

 Syntax
   func uint curdrive extern

 Arguments
   None.

 Return
   An integer specifying the current drive. 0 represents drive A:, 1
   represents drive B:, etc.

 Description
   The curdrive() function returns the current DOS disk drive in numeric
   format.

 Example
   #define EXAMPLE_FILE
   #include example.hdr

   func uint DriveNum
   // Return number of valid drive letters
   vardef
      uint nLetter
      uint n
      uint nDrives
      uint nCurDrive
   enddef
   nCurDrive := curdrive()      // save current drive
   nLetter := 0
   nDrives := 0
   for n := 'A' to 'Z'          // test all drive characters
      selectdrive( nLetter )    // attempt to switch to a drive
      if nLetter == curdrive()  // if successful
         nDrives++              // count drives
      endif
      nLetter++                 // next drive
   next
   selectdrive( nCurDrive )     // restore original drive
   return( nDrives )
   endproc
   
   proc Test_curdrive
   ? "Number of drives is", istr( DriveNum() )
   endproc

   proc main
   Test_curdrive()
   endproc

See Also: curdir() curdisk() set default to

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