|
Lol! Well, a "free" example is always nice, though I could take you out for a hotdog and a beer next time we are at the same conference to pay off my debt. I will make sure they have Klements on the grill ;-)
Hmmm.. the last conference we were both at would've been RPG And Beyond. If only there was a way to drink beer over the Internet... :) (Sorry, the headline "Drunk Driving on the Information Superhighway" just came to mind.)
... Instead of "reading" as much out of the user space as I am, should I instead read up to dMicroSecSnt, and then use the value in dOfsNext to determine where I should find the beginning of dOfsNFldR - essentially skipping over the dReserve1 variable?
Yes, you have the right idea. Though, it's the dOfsFrtn field, not dOfsNext, that you should use. Basically "dOfsFrtn" is the distance from the start of the user space to the dOfsNFldR field. So, if dOfsFrtn is 64, then you start reading with position 65 to get dOfsNFldR.
An offset is a "distance" from point A to point B. APIs usually refer to offsets as being the distance from the start of the user space to a particular field. So, if the API says "offset 64" then you start at position 1 of the user space, and count forward 64 bytes. 1+64 = 65.
In that case it seems having a second DS with dOfsNFldR through dData would be the way to go as I would be reading into that structure multiple times based on the offsets (correct?).
Absolutely right.
Guess I should be reading your Intro To API articles more closely eh? ;-) Doesn't seem like I come across API's that return multiple sets of data as much though.
I wrote a quick n dirty free format example. Here's what it does differently than the example you posted.
a) It keeps the API prototypes in a /COPY member.b) It uses pointer logic (which is faster and easier, IMHO) to access the data in the user space.
c) It uses the offsets correctly :)d) It writes the result to an IFS stream file in ASCII text format to a stream file in the IFS, and displays it with the DSPF command.
It's extremely quick & dirty -- but perhaps it'll be easier to read than the one you posted. (It's easier for me -- but I'm a bit biased!)
The code can be found here: http://www.scottklement.com/rpg/listlog.zip
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.