|
Simon, I agree that what you have to do in C is "different" but "better", I'm not sure I agree. Granted for simple concatenation routines, RPG IV is better, but I like the wrapper I built for sprintf, called FmtText(). I allows this: Eval msg = fmttext('Hello %s, your are %s years old.': fname: %char(age)) It makes it so much easier to format the text properly and insert/change text later on. -Bob -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Simon Coulter Sent: Thursday, September 16, 2004 4:58 AM To: RPG programming on the AS400 / iSeries Subject: Re: calling C from OPM RPG On 16/09/2004, at 12:53 AM, Bob Cozzi wrote: > Prototyping printf() was a challenge due to the polymorphic aspects of > the > parameters. (Did I just use the "p" word in a sentence? Sorry.) Why would you bother? RPG IV has better support for converting and concatenating mixed variables into a string than C has. Then if you must use printf() or its siblings you need only prototype it with two string parameters. Thus: C EVAL message = "The count is " + %EDTC(count: 'X') + C " and the item is " + item C CALLP prinf("%s", message) or /FREE message = "The count is " + %EDTC(count:'X') + "and the item is " + item; printf("%s", message); /ENDFREE if you prefer. Regards, Simon Coulter. -------------------------------------------------------------------- FlyByNight Software AS/400 Technical Specialists http://www.flybynight.com.au/ Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 /"\ Fax: +61 3 9419 0175 \ / X ASCII Ribbon campaign against HTML E-Mail / \ -------------------------------------------------------------------- -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.