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
 Q: formatting double value in string

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
hajo_old Posted - 02/27/2003 : 08:26:12 AM
Hello, all

within my function I want to set the title of a graphics page with the following code snippet:

the variable ti is read out from an page.info value (I guess it is a double value within the page.info structure)



string legend;
legend = "\\b(Einspritzverläufe K" + kunde + ")\r\n";
legend = legend + "\\b(Vergleich der Einzelinjektoren - FUP: " + (int)fup + " [bar], ";
legend = legend + "t\-(i, main): " + ti + " [ms])";
LTCmd = "title.text$ = " + legend;
LT_execute(LTCmd);



this works so far. But the variable ti shows up as "0.658000000001"
and it should be only "0.658" as lable text!

How can I set the mantisse within a string to enshure it is shown on the graphics page as "0.658"!!

Thanks Hajo

-- --
Dipl.-Ing. Hans-Joerg Koch
Siemens VDO, Regensburg

SVDO_Origin1
2   L A T E S T    R E P L I E S    (Newest First)
hajo_old Posted - 02/27/2003 : 10:10:21 AM
Thanks Easwar

-- --
Dipl.-Ing. Hans-Joerg Koch
Siemens VDO, Regensburg

SVDO_Origin1
easwar Posted - 02/27/2003 : 09:39:59 AM
Hi Hajo,

Look up the Format member function in the string class.
You can use that to place values in the string using a specified format.

For example,

string strPi;
strPi.Format("Value of pi = %5.2f", pi);
printf("%s\n", strPi);



Easwar
OriginLab.



Edited by - easwar on 02/27/2003 09:47:39 AM

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