Click here to Skip to main content
15,904,288 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: about return values.. Pin
toxcct6-Mar-08 22:33
toxcct6-Mar-08 22:33 
GeneralRe: about return values.. Pin
Rajkumar R6-Mar-08 22:53
Rajkumar R6-Mar-08 22:53 
GeneralRe: about return values.. Pin
Maxwell Chen6-Mar-08 23:08
Maxwell Chen6-Mar-08 23:08 
QuestionRe: about return values.. Pin
Rajesh R Subramanian6-Mar-08 23:15
professionalRajesh R Subramanian6-Mar-08 23:15 
GeneralRe: about return values.. Pin
Maxwell Chen6-Mar-08 23:17
Maxwell Chen6-Mar-08 23:17 
GeneralRe: about return values.. Pin
Rajkumar R6-Mar-08 23:56
Rajkumar R6-Mar-08 23:56 
GeneralRe: about return values.. Pin
toxcct6-Mar-08 23:58
toxcct6-Mar-08 23:58 
QuestionRe: about return values.. Pin
savitri6-Mar-08 23:25
savitri6-Mar-08 23:25 
Confused | :confused: if(retcode >=0)
{
writecard(BLCK,m_Date);
}
else
{
MessageBox("Error in writing exp date");
}
now i am not able to write the data into the card run time error is coming. my full code is like this:
long CACR120RWBLOCK1Dlg::writecard(BYTE BLCK, CString strData)
{
int ctr;
int x;
//writecard(BLCK,strData) = -1;
retcode=-1;
BYTE dout[15];
for (ctr=0;ctr<=15;ctr++)
{
dout[ctr]=atoi("");
}
x=strlen(strData);
for(ctr=0;ctr<=x-1;ctr++)
{
dout[ctr]=strData[ctr+1];

}
retcode = ACR120_Write(rHandle, BLCK, dout[0]);
StrMsg.Format("Retcode:%d",retcode);
LstIndx=m_List.AddString(StrMsg);
//writecard(BLCK,strData) =retcode;
return retcode;
}
and my write function is like this:

void CACR120RWBLOCK1Dlg::OnWrite()
{
// TODO: Add your control notification handler code here
BYTE BLCK;
BYTE ResultSN[11];
BYTE TagType[50];
BYTE ResultTag;
char SN[100];
int ctr;
int x;
//writecard()
BYTE dout[15];
//int ctr;
//VerifyKeyA(2);

retcode = ACR120_Select(rHandle, TagType, &ResultTag, ResultSN);
StrMsg.Format("retcode:%d",retcode);
LstIndx=m_List.AddString(StrMsg);

//'Check if Retcode is Error
if (retcode < 0)
{
//MessageBox("Error in select");
StrMsg.Format("Error Select: %d", retcode);
LstIndx = m_List.AddString(StrMsg);

}
else
{
//VerifyKeyA(2);
StrMsg.Format("Select Card Success: %d", retcode);
LstIndx=m_List.AddString(StrMsg);
sprintf(SN,"%s","");
if ((TagType[0] == 4) || (TagType[0] == 5))
{

memcpy(SN,ResultSN, 7);
StrMsg.Format("Card Serial: %02x %02x %02x %02x %02x %02x %02x ",ResultSN[0],ResultSN[1],ResultSN[2],ResultSN[3],ResultSN[4],ResultSN[5],ResultSN[6] );

}
else

memcpy(SN,ResultSN, ResultTag);


if (ResultTag == 4)

StrMsg.Format("Card Serial: %02x %02x %02x %02x ",ResultSN[0],ResultSN[1],ResultSN[2],ResultSN[3] );

else if (ResultTag == 7)

StrMsg.Format("Card Serial: %02x %02x %02x %02x %02x %02x %02x ",ResultSN[0],ResultSN[1],ResultSN[2],ResultSN[3],ResultSN[4],ResultSN[5],ResultSN[6] );

else if (ResultTag == 10)

StrMsg.Format("Card Serial: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x ",ResultSN[0],ResultSN[1],ResultSN[2],ResultSN[3],ResultSN[4],ResultSN[5],ResultSN[6],ResultSN[7],ResultSN[8],ResultSN[9] );


//m_Sno.FormatMessage(SN);
//StrMsg.Format("SN:%s",SN);

m_List.AddString(StrMsg);
}
m_List.SetCurSel(LstIndx);

pKey[0]= 255;
pKey[1]= 255;
pKey[2]= 255;
pKey[3]= 255;
pKey[4]= 255;
pKey[5]= 255;

sec=2;

//Login Command Function
retcode = ACR120_Login(rHandle, sec, 0xAA, 0, pKey);
StrMsg.Format("retcode: %d", retcode);
LstIndx=m_List.AddString(StrMsg);

//'check if retcode is error
if (retcode < 0)
{

StrMsg.Format("Error Login: %d", retcode);
LstIndx=m_List.AddString(StrMsg);
//m_cSNO=StrMsg;
//LstIndx = strlen(m_cSNO);

}
else
{

MessageBox("Login Success:");

//m_SNO=StrMsg;
//m_SNO="Log at Sector: 1";
//LstIndx = strlen(m_SNO);
m_ReadBlk.EnableWindow(true);
m_WriteBlk.EnableWindow(true);
//Result=true;;

}
BLCK =0;
sec = 2;
BLCK = sec * 4 + BLCK;
//retcode = ACR120_Write(rHandle, BLCK, dout[0]);
retcode=writecard(BLCK,m_MemId);
if(retcode >= 0)
{
//writecard(BLCK,m_MemId);
}

else
{
MessageBox("Error in writing");
}

BLCK =1;
sec=2;
BLCK=sec*4+BLCK;
retcode=writecard(BLCK,m_Memname);
if(retcode>=0)
{
//writecard(BLCK,m_Memname);
}
else
{
MessageBox("Error in writing name of Employee");
}

BLCK=2;
sec=2;
BLCK=sec*4+BLCK;
retcode=writecard(BLCK,m_Date);
if(retcode>=0)
{
//writecard(BLCK,m_Date);
}
else
{
MessageBox("Error in writing exp date");
}

//VerifyKeyA(3) ;
pKey[0]= 255;
pKey[1]= 255;
pKey[2]= 255;
pKey[3]= 255;
pKey[4]= 255;
pKey[5]= 255;

sec=3;

//Login Command Function
retcode = ACR120_Login(rHandle, sec, 0xAA, 0, pKey);
StrMsg.Format("retcode: %d", retcode);
LstIndx=m_List.AddString(StrMsg);

//'check if retcode is error
if (retcode < 0)
{

StrMsg.Format("Error Login: %d", retcode);
LstIndx=m_List.AddString(StrMsg);
//m_cSNO=StrMsg;
//LstIndx = strlen(m_cSNO);

}
else
{

MessageBox("Login Success:");

//m_SNO=StrMsg;
//m_SNO="Log at Sector: 1";
//LstIndx = strlen(m_SNO);
m_ReadBlk.EnableWindow(true);
m_WriteBlk.EnableWindow(true);
//Result=true;;

}

BLCK=0;
sec=3;
BLCK=sec*4+BLCK;
retcode=writecard(BLCK,m_Balance);
if (retcode>=0)
{
//writecard(BLCK,m_Balance);

}
else
{
MessageBox("Error in writing balance");
}
}
my retcode and rhandle value is of type integer.
please help me.
thanku,
savitri
GeneralRe: about return values.. Pin
toxcct6-Mar-08 23:28
toxcct6-Mar-08 23:28 
GeneralRe: about return values.. Pin
savitri6-Mar-08 23:49
savitri6-Mar-08 23:49 
GeneralRe: about return values.. Pin
toxcct6-Mar-08 23:54
toxcct6-Mar-08 23:54 
GeneralRe: about return values.. Pin
Rajesh R Subramanian6-Mar-08 23:59
professionalRajesh R Subramanian6-Mar-08 23:59 
GeneralRe: about return values.. Pin
toxcct7-Mar-08 0:06
toxcct7-Mar-08 0:06 
GeneralRe: about return values.. Pin
BadKarma7-Mar-08 1:02
BadKarma7-Mar-08 1:02 
AnswerRe: about return values.. Pin
Rajesh R Subramanian7-Mar-08 0:02
professionalRajesh R Subramanian7-Mar-08 0:02 
GeneralRe: about return values.. Pin
toxcct7-Mar-08 0:07
toxcct7-Mar-08 0:07 
GeneralRe: about return values.. Pin
Rajesh R Subramanian7-Mar-08 0:08
professionalRajesh R Subramanian7-Mar-08 0:08 
GeneralRe: about return values.. Pin
Rajesh R Subramanian6-Mar-08 23:04
professionalRajesh R Subramanian6-Mar-08 23:04 
GeneralDoubt in using Math library Pin
KASR16-Mar-08 21:53
KASR16-Mar-08 21:53 
GeneralRe: Doubt in using Math library Pin
CPallini6-Mar-08 22:05
mveCPallini6-Mar-08 22:05 
GeneralRe: Doubt in using Math library Pin
toxcct6-Mar-08 22:06
toxcct6-Mar-08 22:06 
GeneralRe: Doubt in using Math library Pin
KASR16-Mar-08 22:45
KASR16-Mar-08 22:45 
GeneralRe: Doubt in using Math library Pin
toxcct6-Mar-08 22:50
toxcct6-Mar-08 22:50 
AnswerRe: Doubt in using Math library Pin
CPallini7-Mar-08 0:12
mveCPallini7-Mar-08 0:12 
GeneralRe: Doubt in using Math library Pin
KASR17-Mar-08 0:14
KASR17-Mar-08 0:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.