Author |
Topic  |
|
winflowers
USA
34 Posts |
Posted - 09/18/2007 : 10:06:50 AM
|
Origin Version (Select Help-->About Origin): Origin 7.5 (SR6) Operating System: Windows XP (SP2) German
I am running English version of Origin under German Windows XP. And the decimal character of Origin is set as same as the Windows, i.e. ',' is used instead of '.'. No problem in Origin, but in OriginC I get some troubles. In some cases, OriginC just omits the decimal. For example, atof("0,7") gives 0. Also GETN_NUM() could not pass the correct value. I have to replace ',' with '.' manually, then everything goes fine and the output value is correct with ',' as decimal character. But this causes confusion. Is there any way to solve this problem?
Thank you! |
|
Kstadler
Germany
Posts |
Posted - 09/27/2007 : 05:45:39 AM
|
Hi, I had the same problem. My solution: Get information out of a datasheet as a string (wks.GetCell). Replace , by . For that purpose I wrote a tiny procedure:
int ConvStr(char* CText, char Von, char Zu)
// return -1: no text // else: Number of subst. { int ConvRet = 0; if (*CText == 0) return -1; while (*CText != 0) { if (*CText == Von) { *CText = Zu; ConvRet++; } CText++; }
return ConvRet; }
You can call this function like this: ConvStr(String, ',', '.'); //Replace , with .
The conversion is only necessary, if you get data out of a worksheet. When you write a float number to a WKS (e.g. with SetCell), Origin converts the . by , itself.
I hope I could help Konstantin Stadler |
 |
|
|
Topic  |
|
|
|