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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Decimal character in OriginC?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

winflowers

USA
34 Posts

Posted - 09/18/2007 :  10:06:50 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000