Announcement
Collapse
No announcement yet.
Convert to BYTE PTR
Collapse
X
-
Maybe something like this?
Code:#COMPILE EXE #DIM ALL FUNCTION PBMAIN () AS LONG LOCAL dwOffset AS DWORD LOCAL pData AS BYTE PTR LOCAL myData AS STRING dwOffset = &H654321 myData = REPEAT$(1400000, CHR$(3,123,33,51,66,211,92,244)) 'any data string pData = STRPTR(myData) + dwOffset ? MKBYT$(@pData) 'this shows you the byte at offset &H654321 ? STR$(@pData) 'this shows you the value of the byte at offset &H654321 END FUNCTION
Leave a comment:
-
Jay,
If you are not comfortable using pointers then you could always use PB's PEEK and POKE statements. IIRC, the new versions of those statements are extremely fast.
Leave a comment:
-
Insufficient code shown.
As written, pData is zero, meaning this will GPF (or ERR 9, but ON ERROR is not in use).
What do you want to do, take the byte value at 'dwoffset' and put it somewhere? (Like, into a byte variable?) Then you need a byte variable to store it in.
Maybe you mean something like ...
Code:LOCAL data as BYTE LOCAL pData AS BYTE PTR pData = (ADDRESS of the base of whatever dwOffset is from) + dwoffset data = @pData
.. something like that?
MCM
Leave a comment:
-
Convert to BYTE PTR
Code:LOCAL dwOffset AS DWORD LOCAL pData As BYTE PTR dwOffset = &H654321 @pData = CBYT PTR(dwOffset)
Thanks.Last edited by Jay Straffer; 13 Feb 2009, 07:59 PM.Tags: None
Leave a comment: