|
rpg400-l-request@xxxxxxxxxxxx wrote:
> 8. Re: QWCCVTDT frustrations (Scott Klement)
>
>You state that the following code works. I find that very hard to
>believe, since the code doesn't make sense. (I tried it, it doesn't work
>on my system)
>
>> InVarPtr S *
>> (the pointer to the variable that contains the *DTS data to convert,
>> passed into program)
>> InVar S * Based(InVarPtr)
>> OutVar S 17A
>> InFmt S 10A Inz('*DTS')
>> OutFmt S 10A Inz('*YYMD')
>>
>> Call 'QWCCVTDT'
>> Parm InFmt
>> Parm InVar
>> Parm OutFmt
>> Parm OutVar
>
>Why doesn't this code work?
>
<snip>
>
>b) The API is expecting "InVar" to be a character string, and you're
>passing a pointer. Therefore, when it reads it, it'll get the bytes of a
>memory address rather than the bytes of an actual DTS date.
I looked at that and couldn't make sense for a while. Then I realized that he
wasn't "passing a pointer; it only _looks_ like he's passing a pointer because
that's how he declared it. He's actually passing the _address_ of the pointer
which he's set to be the same as the address that was originally passed in.
Since it's a program call, the _address_ is what's important regardless of how
he declares the variable stored at that address.
No?
What a great example of misdirection.
Tom Liotta
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.