-
cut problem
Hi
OK I have the following problem:
Code:
char *Servaddress;
char ip[256];
char user[256];
char password[256];
int port;
int temp = 0;
temp = sscanf(Servaddress,"ftp://%s:%s@%s:%d",&user,&password,&ip,&port);
But the result is not what I have expected. I read that %s will read subsequent characters until a whitespace is found. But I need sth which read until the character I want is find, e.g. : or @.
Any ideas?
-
Use a scanset. And supply a width for the strings.
Code:
temp = sscanf(Servaddress,"ftp://%255[^:]:%255[^@]@%255[^:]:%d",
user,password,ip,&port);
-
Great :)
Works perfect. Thank you.