-
Comparing
Hi,
Im trying to compare a char* (vsDni) with the data from a text box.
Here is a sample of the code.
Code:
int dni;
TCHAR cDni[20];
dni= IsDlgButtonChecked(u_hDlg,IDC_CHECK_DNI);
else if (dni==1)
{
int item_txt_dni = GetDlgItemText(u_hDlg, IDC_DNI, cDni, 20);
if (strcmp(vsDNI, cDni) == 0)
{
sprintf(sOutput, " %-3.3d Make call %s %s ", viLine, vsANI, vsDNI);
vLog(sOutput);
}
}
So if the two are equal then do the print statement.
Doesnt seem to be working!
Is this the best way to do this?
If not can anyone suggest a better way?
Any help whatsoever would be great,
thanks a lot,
:)
-
> else if (dni==1)
doesn't appear to be correct. Else what?
Should not compile anyway. Unless you have not pasted the complete code.
Where do you declare & set vsDNI?
-
Hi,
ok here is the whole code, ive tried to put the relevant code in orange! Dont know if it worked, if not just read previous post!
Code:
void LogData(int viLine, char* vsANI, char* vsDNI)
{
int err44;
int line;
int cli;
int dni;
int errs;
int cCli;
TCHAR cDni[20];
//char test[100];
char sOutput[100];
err44= IsDlgButtonChecked(u_hDlg,IDC_CHECK1);
line= IsDlgButtonChecked(u_hDlg,IDC_CHECK_LINE);
cli= IsDlgButtonChecked(u_hDlg,IDC_CHECK_CLI);
dni= IsDlgButtonChecked(u_hDlg,IDC_CHECK_DNI);
errs= IsDlgButtonChecked(u_hDlg,IDC_CHECK_ERRS);
if(err44==1)
{
}
else if (line==1)
{
int iLineToShow = GetDlgItemInt(u_hDlg, IDC_LINE, NULL, TRUE);
if (iLineToShow == viLine)
{
sprintf(sOutput, " %-3.3d Make call %s %s ", viLine, vsANI, vsDNI);
vLog(sOutput);
}
}
else if (cli==1)
{
int item_txt_cli = GetDlgItemInt(u_hDlg, IDC_CLI, cCli, TRUE);
if (vsANI == cCli)
{
sprintf(sOutput, " %-3.3d Make call %s %s ", viLine, vsANI, vsDNI);
vLog(sOutput);
}
}
else if (dni==1)
{
int item_txt_dni = GetDlgItemText(u_hDlg, IDC_DNI, cDni, 20);
if (strcmp(vsDNI, cDni) == 0)
{
sprintf(sOutput, " %-3.3d Make call %s %s ", viLine, vsANI, vsDNI);
vLog(sOutput);
}
}
else if (errs==1)
{
}
else
{
sprintf(sOutput, " %-3.3d Make call %s %s ", viLine, vsANI, vsDNI);
vLog(sOutput);
}
sprintf(sOutput, "cDni is <%s> ", cDni);
vLog(sOutput);
}
Anything else you need for you to help me just ask!
Thanks again :)