Do you have an example of the prototype for the tmpnam() ?

Tor ILE C, the prototype is in stdio.h and ifs.h, and looks like this:

   char *tmpnam(char *);

If you've told the compiler to use IFS for I/O, it runs the following #pragma to map it to a different function in a different service program.

   #pragma map ( tmpnam,   "_C_IFS_tmpnam")

For ILE RPG, you have to write your own prototype. Instead of the #pragma, you use extproc().

For QTEMP:
     D tmpnam          PR              *   extproc('tmpnam')
     D   string                      39A   options(*omit)

For IFS:
     D tmpnam          PR              *   extproc('_C_IFS_tmpnam')
     D   string                      39A   options(*omit)

RPG programs also need BNDDIR('QC2LE') in their H-specs so that they'll be able to find the function.

To call it from RPG, you do this:

     D filename        s             40A   varying

        filename = %str(tmpnam(*OMIT));


Or, from C:

     char *filename;

       filename = tmpnam(NULL);


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.