× 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.



Well, I thought I could call sprintf() from RPGIV with Integer
parameters and have it return the string, but I've been unable to get it
working. I'm sure its just a subtlety in the syntax. But I've sent a
note to Barbara Morris at the Toronto lab with this code asking if she
can determine what's wrong with it. Here's what I've sent to her, and
done so far.
     H BNDDIR('QC2LE') actgrp('QILE')
     ** int sprintf( char *buffer, const char *format [, argument] ...
);
     D  nRed           S              5I 0 INZ(128)
     D  nGreen         S              5I 0 INZ(255)
     D  nBlue          S              5I 0 INZ(192)

     D sprintf3        PR            10I 0 ExtProc('sprintf')
     D  szRecvVar                      *   VALUE Options(*STRING)
     D  szFormat                       *   VALUE Options(*STRING)
     D  Red                           5I 0
     D  Green                         5I 0
     D  Blue                          5I 0

     D szBuffer        S             20A
     D szColor         S             16A
     D pColor          S               *
     C                   Eval      szColor = *ALLX'00'
     C                   Eval      pColor  = %addr(szColor)
     C                   CallP     sprintf3(pColor : '%02x:%02x:%02x' :
     C                               nRed:nGreen:nBlue )
     C                   Eval      szBuffer = %str(pColor)
     C                   MOVE      *ON           *INLR

Bob Cozzi
cozzi@rpgiv.com
Visit the new on-line iSeries Forums at: http://www.rpgiv.com/forum




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.