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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Passing arguments to string functions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Mike Buess

USA
3037 Posts

Posted - 05/27/2002 :  1:24:05 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
What is the proper way to pass string and character arguments to an OriginC string function? For example,

int test(string str1="abcdef", char ch1='c')
{
return str1.Find( ch1 );
}

test()=;
test()=2 //as expected, but

test(abcdef,c)=;
test(ABCDEF,C)=6

This function returns the string length regardless of the arguments I use. What am I doing wrong?

Mike Buess
Origin WebRing Member

cpyang

USA
1406 Posts

Posted - 05/27/2002 :  3:02:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
test("abcdef", 'c')=;

You must indicate passing as character or as string to avoid confusion.

CP




Edited by - cpyang on 05/27/2002 15:04:35
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 05/27/2002 :  8:26:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks, CP.

Mike Buess
Origin WebRing Member
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000