[ back to toc ]

c string or char manipulation

Date: 2002/05/23 17:49

Q:
C programming for unix/windows.
Hello sir,

Can you tell me how it is possible to truncate the www. from
www.anyname.com and print it on the end of another statement like:
webmaster@"anyname.com goes here.

thank you.

*NAME-DELETED*
A:
In C you can manipulate strings, but you have to allocate memory to store
the strings. The following code fragment may help.

char *s = "www.anyname.com"
char b[100];
while( *s && *s != '.' )s++;
strcpy(b,"webmaster@");
strcat(b,s);

Regards,
Peter
Q:
How do i do it so that it keeps the period? i meant to just truncate the
www, sorry:(

leth
A:
*NAME-DELETED*!

You have to be able to solve this. Really. You are kidding!

Peter

[ back to toc ]