LPWSTR tmpValue= new WCHAR[1024];
delete[] tmpValue;
Monday, September 14, 2009
Tuesday, September 8, 2009
Thursday, August 27, 2009
List - Iterator
for(list::iterator it=m_pptInitialSlideIDListNew.begin(); it!=m_pptInitialSlideIDListNew.end(); it++)
{
int iSlideIDCurrent = *it;
}
{
int iSlideIDCurrent = *it;
}
Tuesday, August 25, 2009
Thursday, August 13, 2009
doubleToString
SDBString_ptr SDBUtil::doubleToString(double number) {
char buffer[64];
sprintf(buffer, "%f", number);
//int count, count2;
for(char* p = buffer + strlen(buffer) - 1; p >= buffer; p--) {
if (*p == '0') {
*p = '\0';
} else {
if (*p == '.') {
*p = '\0';
}
break;
}
}
return new SDBString(buffer);
}
char buffer[64];
sprintf(buffer, "%f", number);
//int count, count2;
for(char* p = buffer + strlen(buffer) - 1; p >= buffer; p--) {
if (*p == '0') {
*p = '\0';
} else {
if (*p == '.') {
*p = '\0';
}
break;
}
}
return new SDBString(buffer);
}
stringToDouble
double SDBUtil::stringToDouble(char* data) {
int foundDot = 0;
for(char* p = data; *p; p++) {
if (isdigit(*p)) {
continue;
} else if (*p == '.') {
if (foundDot) {
throw strdup("Input wrong float");
} else {
foundDot = 1;
}
} else {
throw strdup("Input wrong float");
}
}
if (!foundDot) {
throw strdup("Input wrong float");
}
return atof(data);
}
int foundDot = 0;
for(char* p = data; *p; p++) {
if (isdigit(*p)) {
continue;
} else if (*p == '.') {
if (foundDot) {
throw strdup("Input wrong float");
} else {
foundDot = 1;
}
} else {
throw strdup("Input wrong float");
}
}
if (!foundDot) {
throw strdup("Input wrong float");
}
return atof(data);
}
Subscribe to:
Posts (Atom)