www.pudn.com > cghost.rar > RDIR.C


#include  
#include  
#include  
 
main(int argc,char *argv[]) 
{ 
 char presname[MAXPATH]; 
 
 if(argc>1) 
	{ 
	strcpy(presname,argv[1]); 
	} 
 else 
	{ 
	printf("Usage: redir [dirname newname]\n"); 
	exit(1); 
	} 
 if(chdir(presname)) 
	{ 
	printf("\nnot exit this dir\n"); 
	printf("\nnow create this dir\n"); 
	if(mkdir(presname)) 
		{ 
		printf("\nnot enough memory to save data\n"); 
		exit(1); 
		} 
	exit(0); 
	} 
 else 
	{ 
	chdir(".."); 
	} 
 }