[c]代码库
#include <stdlib.h>
#include <stdio.h>
#include <dir.h>
int main ( void )
{
char *s;
char drive[MAXDRIVE];
char dir[MAXDIR];
char file[MAXFILE];
char ext[MAXEXT];
int flags;
s=getenv ( "COMSPEC" ); /* get the comspec environment parameter */
flags=fnsplit ( s,drive,dir,file,ext );
printf ( "Command processor info:\n" );
if ( flags & DRIVE )
printf ( "\tdrive: %s\n",drive );
if ( flags & DIRECTORY )
printf ( "\tdirectory: %s\n",dir );
if ( flags & FILENAME )
printf ( "\tfile: %s\n",file );
if ( flags & EXTENSION )
printf ( "\textension: %s\n",ext );
return 0;
}