well try this one:
Code:
int strip_vowels(char *s_in,char *s_out, int iout_len) {
char vowels[] = "aeiou";
char *pin,*pout , *pv;
pin = s_in;
pout=s_out;
while(*pin) {
pv = vowels;
while(*pv) {
if(*pin == *pv) {
*pout = *pv;
if((int)(pout - s_out -1)>iout_len) {
*pout = '\0';
return -1;//ERROR buffer is out of memory
}
pout++;
break;
}
pv++;
}
pin++;
}
*pout = '\0';
return (int)(pout - s_out -1); /*return the lenght of the out*/
}
int main(void) {
char str[] = "Some testing string";
char out[200];
strip_vowels(str,out,sizeof(out));
printf("there are \"%s\" vowels in\n",out);
printf("\"%s\" string\n",str);
return 0;
}
i made late in the night
and i didn't test it...
Please let me know if it works OK...
The choke point i think is
in the buffer lenght test i think...