The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Decimal character in OriginC?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
winflowers 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!
1   L A T E S T    R E P L I E S    (Newest First)
Kstadler 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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000