www.pudn.com > c.rar > RDIR.C, change:1997-01-26,size:483b


#include <stdio.h> 
#include <dir.h> 
#include <string.h> 
 
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(".."); 
	} 
 }