home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / homonlib.zip / HOMEPATH.BAS < prev    next >
BASIC Source File  |  1995-04-13  |  982b  |  31 lines

  1. DEFINT A-Z
  2.  
  3. DECLARE FUNCTION HomePath$ ()
  4.  
  5. 'External procedures:
  6.  
  7. DECLARE FUNCTION TempName$ (p$)
  8.  
  9. FUNCTION HomePath$
  10. '****************************************************************************
  11. 'Returns the name of the current DOS directory.
  12. '****************************************************************************
  13.  
  14. tempfile$ = TempName$("")          'Make a temporary filename.
  15.  
  16. SHELL ("CD > " + tempfile$)        'Shell out and redirect the output of the
  17.                                    'DOS command "CD" to the temporary file.
  18.  
  19. fh = FREEFILE                      'Get the next available file handle.
  20.  
  21. OPEN tempfile$ FOR INPUT AS #fh    'Open the temporary file.
  22. LINE INPUT #fh, hp$                'Read in the one and only line.
  23. CLOSE #fh                          'Close the file.
  24.  
  25. KILL tempfile$                     'Delete the temporary file.
  26.  
  27. HomePath$ = hp$                    'Return the name of the current directory.
  28.  
  29. END FUNCTION
  30.  
  31.