- int del_substr(char *str, char const *substr)
- {
- char *strstr1=str;
- int sublength=strlen(substr);
- if(*str1!='\0' && *substr!='\0')
- {
- while (*substr!='\0')
- {
- char const *sub=substr;
- while (*str1!='\0')
- {
- if (*sub==*str1)
- {
- sub++;
- str1++;
- }
- else{
- sub=substr;
- str1++;
- }
- if (*sub=='\0'){
- while (*str1!='\0')
- {
- *(str1-sublength)=*str1;
- str1++;
- }
- *(str1-sublength)='\0';
- return 1;
- }
- }
- if (*str1=='\0') return 0;
- }
- }else return 0;
- }