Using PTR's 
Author Message
 Using PTR's

I'm having some problems with PTR, Basically, I've called some API's that
leave the results in a buffer which contains an array of variable pointer
and the data. What I thought that I could do was to copy the first 4 byte's
into a PTR variable and so forth, to be able to access the data (in string
format). However, I don't seem to be able to get the ptr loaded correctly.

e.g.

Type MyStruc
    Name as string Ptr
end type

dim Buffer(200) as byte
dim x as string ptr
dim y as asciiz ptr
dim OutPutString(100) as string

'do call to API that loads Buffer

Do
    'need to copy Buffer(0), 4 bytes into x so that I could do something
like


Loop

Any help would be appreciated
Thanks



Thu, 09 Jan 2003 03:00:00 GMT  
 Using PTR's

Quote:

>I'm having some problems with PTR, Basically, I've called some API's that
>leave the results in a buffer which contains an array of variable pointer
>and the data. What I thought that I could do was to copy the first 4 byte's
>into a PTR variable and so forth, to be able to access the data (in string
>format). However, I don't seem to be able to get the ptr loaded correctly.

>e.g.

You've got yourself adding apples and oranges. I <think> the code below is
about what you want.

--
C'ya,

  Don Schullian
www.DASoftVSS.com
www.basicguru.com

Type MyStruc
  Name as DWORD
end type

dim x_ptr as string ptr *   1
dim y_ptr as asciiz ptr * 100
dim OutPutString as string

'do call to API that loads Buffer

Y_ptr = Name

X_ptr = VARPTR(OutPutString)
FOR X = 0 TO LEN(Outputstring)-1

NEXT



Fri, 10 Jan 2003 03:00:00 GMT  
 Using PTR's
I've had LOTS of problems using pointers in PB/CC. I solved most of my
problems by using the pointers in PEEK and POKE commands.


Quote:
> I'm having some problems with PTR, Basically, I've called some API's that
> leave the results in a buffer which contains an array of variable pointer
> and the data. What I thought that I could do was to copy the first 4
byte's
> into a PTR variable and so forth, to be able to access the data (in string
> format). However, I don't seem to be able to get the ptr loaded correctly.

> e.g.

> Type MyStruc
>     Name as string Ptr
> end type

> dim Buffer(200) as byte
> dim x as string ptr
> dim y as asciiz ptr
> dim OutPutString(100) as string

> 'do call to API that loads Buffer

> Do
>     'need to copy Buffer(0), 4 bytes into x so that I could do something
> like


> Loop

> Any help would be appreciated
> Thanks



Wed, 15 Jan 2003 03:00:00 GMT  
 Using PTR's
JFYI, this thread 'continues in alt.lang.powerbasic...

Quote:

>I've had LOTS of problems using pointers in PB/CC. I solved most of my
>problems by using the pointers in PEEK and POKE commands.

Lance
PowerBASIC Support

-------------------------------------------------------------------------
PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com



Sat, 25 Jan 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. jmp word ptr and jmp dword ptr

2. I'm stupid with Declare and ByRef a Ptr

3. does Call Library function support ptr to ptr to int?

4. Ptr size for Declares

5. What is Ptr?

6. Ptr of a string

7. PTR Prentice Hall Object-Oriented Catalog

8. VO : How to use PSZ and PTR?

9. crossed definitions of objects (how to get a ptr to another object)

10. SYSTEM.PTR

11. SYSTEM.PTR: scanned by GC?

12. Q: Ptr to elem of open array

 

 
Powered by phpBB® Forum Software