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
 strcat and rename a graph

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
yulisunflower Posted - 11/03/2009 : 1:20:42 PM
Origin 7.6 SR6
Operating System: Vista
Hi,

I asked in this forum a few days ago about how to change the name of a graph to the name of the column. Sometimes I need to fit the same data with different models and compare them. So I want to append a "_2" after the name of the column to name the new graph. I tried strcat and it didn't work. I cannot give the name of the column,which is a string, to a character array. Anyone knows how to solve this problem? Thanks a lot.

Best
Yu
3   L A T E S T    R E P L I E S    (Newest First)
yulisunflower Posted - 11/04/2009 : 1:01:31 PM
That is easy and works well. Thank you for both of you.

Yu
Iris_Bai Posted - 11/03/2009 : 10:26:22 PM
Hi,

In Origin C, you can:

int n = 2;
string str = "abc_" + n;

Or

string str;
int n = 2;
str.Format("%s_%d", "abc", n);


Iris
Sophy Posted - 11/03/2009 : 9:33:49 PM
Hi, Yu:

I suggest that you use Origin string object to construct a new name in this case. Please refer to the following code:

void str_cat()
{
	string strColName = "A";
	
	strColName = strColName + "_2"; //no need to use strcat here.
	
	GraphPage gp;
	gp.Create("Origin");
	gp.Rename(strColName);
	
	return;
}

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