Salem. Thanks for you help on this issue. The problem is solved. The cause of the problem is related to the data type of passed-in login name. It is wide character. So I have to use wcstok not strtok. Thanks
that is where my problem is. the login parameter is like "domain\user". So I have to change it to "domain\\user". I tried the following it is not working
for (i=0; i<strlen(sLogin); i++){
if(sLogin[i] != char(92)&& bDomain == false ){
sDomain[i]=sLogin[i];
}
else{
bDomain == true...
Salem, Thanks for the reply. However, login info is entered in user interface no windows console, it is passed in as the parameter. when buff char array got it, it will be like "domain\user". If I changed you code based on this scenario, it will not work,
#include <stdio.h>
#include <string.h>...
if the user type in "domain\username" in login page, the string passed in is "domain\username". The strtok can not parse this string correctly. That is why I need to add one more "\", but I do not know how to do it in the source code.
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, "\\" )...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.