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
 string case problem

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
asteria Posted - 10/05/2006 : 1:25:23 PM
Origin Version (Select Help-->About Origin): 7.5 SR5
Operating System: XP Home

In Origin C, it seems that it can not keep the case of the input. It always change it to upcase. For example, in OriginC:
int test(string sWks)
{ printf("sWks' name is:%s\n", sWks);
return 1;}
Afer compiling, I use this function in script window:
test("d")=
It always gives:
sWks' name is:D // note D, insted of d
TESTD("D")=1

How to solve this?
3   L A T E S T    R E P L I E S    (Newest First)
asteria Posted - 10/06/2006 : 12:58:55 PM
What Mike said is right.
I did further test. It seems the return type of the OC function is related.

void test1(string sWks)
{
printf("test1 sWks is:%s\n", sWks);
}
int test2(string sWks)
{
printf("test2 sWks is:%s\n", sWks);
return 1;
}

%R="ddDD";
test1(%R);
test1 sWks is:ddDD

test2(%R)=;
test2 sWks is:DDDD
TEST2(ddDD)=1
Mike Buess Posted - 10/06/2006 : 07:51:00 AM
Literal strings are often converted to upper case when passed from LabTalk to Origin C. Passing the string as a letter variable is no better...

%A=d;
test(%A)=;
sWks' name is:D
TEST(d)=1

The solution is to use Origin 7.5's new $ string variable...

strVar$=d;
test(strVar$)=;
sWks' name is:d
TEST(STRVAR$)=1;

See the Programming Guide for more about $ string variables.
LabTalk Language Reference > Overview... > Data Types > String Variables

...Note that a letter string variable will work if you use LT_get_str to get its value.

int test2(string strLetter)
{
char chBuffer[16];
LT_get_str("%" + strLetter, chBuffer, 16);
printf("sWks' name is:%s\n", chBuffer);
return 1;
}

%A=d;
test2(A)=;
sWks' name is:d
TEST2(A)=1

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 10/06/2006 08:35:42 AM

Edited by - Mike Buess on 10/06/2006 08:44:20 AM
rlewis Posted - 10/05/2006 : 2:25:00 PM
After compiling asteria's test code I also noticed the following ...

test(CCcc);
sWks' name is:CCcc

test(CCcc)=;
sWks' name is:CCCC
TEST(CCCC)=1

test("CCcc")=;
sWks' name is:CCCC
TEST("CCCC")=1

test("CCcc");
sWks' name is:CCcc

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