|
On 01/10/2004, at 8:16 AM, David C. Shea wrote:
Now I have only one more question. I need to pass the resulting RRN back to the calling CL program. I am passing parameters into the C program (to get the file name, lib, etc) but now I need to know how to get the resulting number back to the CL.
Welcome to the joys of C! NOT!
You could pass the RRN back as the return value from main. So
int main ( int argc, char * argv[] ) {
return(rrn); }
int main ( int argc, char * argv[] ) {
memcpy( argv[5], &rrn, sizeof(rrn) ); return(0); }
or
int main ( int argc, char * argv[] ) { int * rrn = (int*)argv[5];
*rrn = riofb_fwd->rrn; return(0); }
Strings can be handled in a similar manner:
int main ( int argc, char * argv[] ) { const char * data = "Twas brillig and the slithy toves ..." memcpy( argv[1], data, strlen(data) ); return(0); }
as can packed decimal values.
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 / \ --------------------------------------------------------------------
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.