Author |
Topic  |
|
asteria
USA
Posts |
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?
|
|
rlewis
Canada
253 Posts |
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
|
 |
|
Mike Buess
USA
3037 Posts |
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 |
 |
|
asteria
USA
Posts |
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
|
 |
|
|
Topic  |
|