|
this code works on v5r3. basically, passing by reference passes a pointer to
the variable to the called proc. getcwd expects the length of the arg1 return
buffer to be passed by value in arg2. To do that you pass the 2nd arg *BYVAL.
-Steve
PGM
dcl &cwd *char 20
dcl &cwdSx *int 4
chgvar &cwdsx 20
CALLPRC PRC('getcwd') PARM((&CWD) (&CWDSX *BYVAL))
sndpgmmsg msg(&cwd)
endpgm
-----Original Message-----
From: Arco Simonse [mailto:arcosimonse@xxxxxxxxxxx]
Sent: Wednesday, January 10, 2007 3:47 PM
To: midrange-l@xxxxxxxxxxxx
Subject: CL callprc and pointers
Hi list,
I have a requirement to call the unixlike function getcwd() directly from a CL
program.
I wonder if that is possible to do.
Since in the first parameter of that function a pointer has to be declared to
the pathvariable, I don't know how to code the CALLPRC to it. (if possible at
all)
After reading the manual over and over I conclude that it is not possible to
find out the address of the CL variable in the calling CL program in which I
want to retrieve the data returned by the getcwd function. Am I right on this?
Thanks, Arco Simonse
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.