I have login name like domain\username, I tried to use strtok to parse it. However, strtok can not recognize "\". For example,
char ustring[] = "domain\username";
sLogin = strtok(ustring, "\\" );
sDomain = sLogin;
while( sLogin != NULL )
{
sUser = sLogin;
sLogin = strtok( NULL, "\\" );
}
Output both sDomain and sUser are domainusername
However, if I change ustring to the following by adding one more "\"
char ustring[] = "domain\\username";
it will parse the login correctly like
sDomain: domain
sUser: username
So any idea how to add one more backslash into login name?
Thanks in advance.
char ustring[] = "domain\username";
sLogin = strtok(ustring, "\\" );
sDomain = sLogin;
while( sLogin != NULL )
{
sUser = sLogin;
sLogin = strtok( NULL, "\\" );
}
Output both sDomain and sUser are domainusername
However, if I change ustring to the following by adding one more "\"
char ustring[] = "domain\\username";
it will parse the login correctly like
sDomain: domain
sUser: username
So any idea how to add one more backslash into login name?
Thanks in advance.