I have the following string: "http://www.google.ie/".I want to create a string "www.google.ie"
How do I do this in C? Here’s what I’ve tried so far:
char* url="http://www.google.ie/";
char* url_stripped=NULL;
char* out=strtok(url,"http://");
while(out){
out=strtok(0,".");
url_stripped=out;
break;
}
printf("%s\n",url_stripped);
But it’s not working.I also fear that if I have a url containing ‘h’, ‘t’, ‘t’ or ‘p’, that things will get messed up.
I also need to be able to stip off “https://” from the beginning.
How about checking if the string starts with
"http://"or"https://", and then skip seven or eight characters, then then search for the first'/'?