How to obtain the current drive through C ?
Ans: We can use the function _getdrive( ) to obtain the current drive.
The _getdrive( ) function uses DOS function 0X19 to get the current drive number
#include
main( )
{
int disk ;
disk = _getdrive( ) + 'A' - 1 ;
printf ( "The current drive is: %c\n", disk ) ;
}
No comments:
Post a Comment