I need to loose the first 7 characters of a string, but im not sure how. Ive looked through the list of the string.h ones and i cant see anything relevent. Any ideas?
Printable View
I need to loose the first 7 characters of a string, but im not sure how. Ive looked through the list of the string.h ones and i cant see anything relevent. Any ideas?
pointer arithmetic, search forumns.
Compare
strcpy( dest, src );
with
strcpy( dest, &src[7] );
.............................>
............................................take it easy -enjoy-Quote:
/* he get only 7 caracter or less than 7 */Code:....
char c[7];
gets(c);
....
or
/* the same condition */Code:...
char c[7];
scanf("%c",&c);
....
Please stop posting enjoy, you're really not helping anyone at all.
yea salem, i just came back to post had searched about a bit, and came up with this, but it isnt working at all. :confused:
Code:void striphttp(char* link)
{
char begging[8], temp[100];
char *p;
strncpy(begging, link, 7);
begging[7] = '\0';
if (strcmp(begging, "http://"))
{
strcpy(temp, &link[7]);
printf("%s\n", temp);
strcpy(link, temp);
}
}
strcmp() returns 0 when the strings are equal
doh!