× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: strfmon() / *help*
  • From: "Joep Beckeringh" <joepb@xxxxxx>
  • Date: Thu, 19 Aug 1999 22:19:50 +0200

Tim and Scott,

The additional parameters have to be doubles.  As for the output string:
because RPG passes by reference, you can just use a (character) field or
data structure and it will be passed as a pointer.  Just make sure that
parameter maxsize contains the length of the field or data structure.  For
the format I would suggest using 'const', because it allows you to use a
literal.  If possible use 'options(*string)'; if not (V3R2; me too)
concatenate with X'00'.  After calling the function use substr (with the
return value) to get rid of the null terminator in string s.

D strfmon         PR            10I 0 ExtProc('strfmon')
D   s                            1A   options(*varsize)
D   maxsize                     10I 0 value
D   format                      10A   const
D   money                        8F   value options(*nopass)

Joep Beckeringh


----- Oorspronkelijk bericht -----
Van: Scott Klement <infosys@klements.com>
Aan: <RPG400-L@midrange.com>
Verzonden: donderdag 19 augustus 1999 17:46
Onderwerp: Re: strfmon() / *help*


> I'm not familiar with strfmon?  Thats not ANSI C, is it?
>
> int strfmon(char *s, size_t maxsize, const char *format, ...);
>
> the ... signifies a variable number of additional parameters,
> you'd need to read about what additional parameters you can
> pass it to it, and set up your prototype as needed.
>
> Given the following line, assuming that money is an int...
> (I'm assuming this because of the %i)
>         strfmon(string, 100, "%i", money); /* $1,234.56      */
>
> Should be something like:
>
> D strfmon         PR            10I 0 ExtProc('strfmon')
> D   s                             *   value
> D   maxsize                     10I 0 value
> D   format                        *   value
> D   money                       10I 0 value options(*nopass)
>
> If you're using V3R7 or later, I'm told that you can use
> options(*string) on your "char" parameters, as well, if you're
> running V3R2 (like me) you'll need to concatenate a x'00' to
> signify the end of the string.
>
> Have fun..

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.