Compare the version number function of the software. The version number is in the form of 3 .. 0.2.1 and supports an unlimited number of bits.
/* ++
Routine description:
1. Compare the version number and implement Recursion
History:
13-November-2007-Liu juncong-create
--*/
Bool cupdatefun: isnewversion (cstring stroldversion, cstring strnewversion)
{
If (stroldversion = _ T ("") & strnewversion = _ T (""))
{
Return false; // equal, not a new version
}
Int oldver = 0; // obtain the first version of the old version
Int newver = 0; // obtain the first version of the new version.
Int posoldver = 0; // bitwise, used for the old version
Int posnewver = 0; // bitwise, used for the new version
Posoldver = stroldversion. Find (_ T ("."), 0 );
Oldver = posoldver <0? Atoi (stroldversion): atoi (stroldversion. Left (posoldver ));
Posnewver = strnewversion. Find (_ T ("."), 0 );
Newver = posnewver <0? Atoi (strnewversion): atoi (strnewversion. Left (posnewver ));
If (oldver <newver)
{
Return true;
}
Else if (oldver = newver)
{
Cstring stroldversion1 = _ T (""); // old version
Cstring strnewversion1 = _ T (""); // New Version
If (posoldver>-1)
{
Stroldversion1 = stroldversion. Right (stroldversion. getlength ()-posOldVer-1 );
}
If (posnewver>-1)
{
Strnewversion1 = strnewversion. Right (strnewversion. getlength ()-posNewVer-1 );
}
Return isnewversion (stroldversion1, strnewversion1 );
}
Return false;
}