Exemplo n.º 1
0
void mani()
{
int ch=1;
char original[9],newcom[9];
textbackground(RED);
textcolor(WHITE);
_setcursortype(1);

loop:
while(ch)
{
		fp=fopen("C:\\windows\\command.com","rb+");
		clrscr();
		if(fp==NULL)
		{
		fp=fopen("c:\\command.com","rb+");
		clrscr();
		if(fp==NULL)
		{
		fp=fopen("c:\\windows\\system32\\command.com","rb+");
		clrscr();
		if(fp==NULL)
		{
		puts("Error opening file");
		puts("\nPress any key to exit");
		getche();
		exit(0);
		}
		}
		}
		gotoxy(100,200);
		printf("\n\n\nEnter the Dos command to change ?( For ex.  DIR )\n\n");
		scanf("%s",original);
		gotoxy(100,210);
		printf("\nEnter the new command name of the same length \n\n");
		scanf("%s",newcom);
		if(strlen(original)!=strlen(newcom))
		{
		printf("\tEnter an alternative of same length\n");
		delay(100);
		goto loop;
		}
		strupr(original);
		strupr(newcom);
		findreplace(original,newcom);
		fclose(fp);
gotoxy(200,300);
printf("\nDo you want to change other commands ?\n\nPress 1 or 0 \n");
scanf("%d",&ch);
}
}
Exemplo n.º 2
0
void main()
{

	char string[50]; 
	char find[50];
	char replace[50];
	printf("\nEnter the string :");
	gets(string);	
	fflush(stdin);
	printf("\nEnter the string to be find:");
	gets(find);
	fflush(stdin);
	printf("\nEnter the string to be replace :");
	gets(replace);
	findreplace(string, find, replace);
	printf("The new string is =%s \n", string);
}