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
 Compilation 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
peter.cook Posted - 05/31/2006 : 06:38:36 AM
Origin Version (Select Help-->About Origin): 7.5 SR6
Operating System: Win 2000

Hi,

I have two functions below :

int test1(string str1, string str2)
{
str1.MakeUpper();
str2.MakeUpper();
return(str1.Find(str2));

}


int test2(string str1, string str2)
{
str1.MakeUpper();
return(str1.Find(str2.MakeUpper()));

}



which I test with

TEST1(INTEGER,PATH|MOLARUNITS|STRING)= .... returns -1
TEST2(INTEGER,PATH|MOLARUNITS|STRING)= .... returns 7

I'm puzzled as to why..

Cheers,

Pete

2   L A T E S T    R E P L I E S    (Newest First)
peter.cook Posted - 05/31/2006 : 09:05:50 AM
Hi Easwar,

Thanks. That makes sense I guess.

Cheers,

Pete

easwar Posted - 05/31/2006 : 08:42:06 AM
Hi Pete,

Note that the MakeUpper() method does not return any value. It just sets the string to upper case. So in the test2 function, str2.MakeUpper() does not return a string as is needed for the Find() function to work.

The compiler should have caught this one - we will look into why it did not - thanks for reporting this.

Easwar
OriginLab



Edited by - easwar on 05/31/2006 08:49:56 AM

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