int checkingDate(string number,int dateDigit)
{
//int currentDigit=0;
int good;
int digitToCheck;
long difDays;
int newYear=0;
string stringYear;
int modCurrentDigit;
string tempDigit;
tempDigit.insert(0,number[dateDigit]);
digitToCheck=atoi(tempDigit.c_str());
//currentDigit=currentDat1.GetYear();
modCurrentDigit=currentDigit%10;
if (modCurrentDigit<digitToCheck){
newYear=currentDigit-modCurrentDigit;
newYear=newYear-10;
newYear=newYear+digitToCheck;
}
else{
newYear=currentDigit-modCurrentDigit+digitToCheck;
}
CTime newDate(newYear,12,31,0,0,0,0);
if(currentDat1<newDate)
good=1;
else
if(isLeapYear(currentDigit)){
difDays=(currentDat1-newDate).GetDays();
if (difDays<=59)
good=1;
else
good=0;
}
else{
difDays=(currentDat1-newDate).GetDays();
if (difDays<=60)
good=1;
else
good=0;
}
return good;
}
Can sombedoy tell me whats the problem with this code.... when I execute it it gives me an Acces Violation when it tries to create the CTime objetc....
Thanks in advance!!!!
{
//int currentDigit=0;
int good;
int digitToCheck;
long difDays;
int newYear=0;
string stringYear;
int modCurrentDigit;
string tempDigit;
tempDigit.insert(0,number[dateDigit]);
digitToCheck=atoi(tempDigit.c_str());
//currentDigit=currentDat1.GetYear();
modCurrentDigit=currentDigit%10;
if (modCurrentDigit<digitToCheck){
newYear=currentDigit-modCurrentDigit;
newYear=newYear-10;
newYear=newYear+digitToCheck;
}
else{
newYear=currentDigit-modCurrentDigit+digitToCheck;
}
CTime newDate(newYear,12,31,0,0,0,0);
if(currentDat1<newDate)
good=1;
else
if(isLeapYear(currentDigit)){
difDays=(currentDat1-newDate).GetDays();
if (difDays<=59)
good=1;
else
good=0;
}
else{
difDays=(currentDat1-newDate).GetDays();
if (difDays<=60)
good=1;
else
good=0;
}
return good;
}
Can sombedoy tell me whats the problem with this code.... when I execute it it gives me an Acces Violation when it tries to create the CTime objetc....
Thanks in advance!!!!