Ecere SDK/eC Forums http://ecere.org/community/ Print view |
|
DynamicString.concatf,concatx http://ecere.org/community/viewtopic.php?f=1&t=377 |
Page 1 of 1 |
Author: | samsam598 [ Fri Oct 04, 2013 2:40 am ] |
Post subject: | DynamicString.concatf,concatx |
Given below code,MessageBox.contents wants to fetch all lines input from editBox1 and a "\n" to separate them line by line.DynamicString.concat(String) works as expected,but for concatf and concatx,maybe I was totall wrong.I just want to concat all inputs into DynamicString buffer.My attempt failed anyway.Help would be appreicated. PS:don't know why first "\n" in editBox2.AddS shows correct ,but all the rest "\n" show as "|.n" here in the post. Code: Select all
|
Author: | jerome [ Fri Oct 04, 2013 5:23 pm ] |
Post subject: | Re: DynamicString.concatf,concatx |
Hi Sam, DynamicString::concatf works like printf so I assume that instead of: buffer.concatf("%s",str," ",str); You meant: buffer.concatf("%s %s",str, str); To add the string twice with a space in between. The other problem here is that you're giving concatf a DynamicString object but %s format specifier expects a char * (or String which is equivalent right now). buffer.concatf("%s %s",(String)str, (String)str); This will ensure the proper conversion properties are invoked. For concatx, buffer.concatx(str, " ", str); this should work, except that DynamicString is missing stringification methods so it shows up with a bunch of commas instead (The default Array behavior that DynamicString inherits from) If you add to the DynamicString class: Code: Select all
Regards, -Jerome |
Author: | samsam598 [ Sat Oct 05, 2013 4:50 am ] |
Post subject: | Re: DynamicString.concatf,concatx |
Thanks.Yes,perfect. |
All times are UTC-05:00 | Page 1 of 1 |
Powered by phpBB® Forum Software © phpBB Limited |